Package org.apache.logging.log4j.spi
Class Provider
java.lang.Object
org.apache.logging.log4j.spi.Provider
Service class used to bind the Log4j API with an implementation.
 
     Implementors should register an implementation of this class with ServiceLoader.
 
     Deprecated: the automatic registration of providers from
     META-INF/log4j-provider.properties is supported for compatibility reasons. Support for this file will
     be dropped in a future version.
 
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final StringConstant inlined by the compilerstatic final StringDeprecated.since 2.24.0static final StringDeprecated.since 2.24.0static final StringSystem property used to specify the class name of the provider to use.static final StringDeprecated.since 2.24.0
- 
Constructor SummaryConstructorsConstructorDescriptionProvider(@Nullable Integer priority, String versions, @Nullable Class<? extends LoggerContextFactory> loggerContextFactoryClass) Provider(@Nullable Integer priority, String versions, @Nullable Class<? extends LoggerContextFactory> loggerContextFactoryClass, @Nullable Class<? extends ThreadContextMap> threadContextMapClass) Provider(Properties props, URL url, ClassLoader classLoader) Deprecated.since 2.24.0
- 
Method SummaryModifier and TypeMethodDescriptionboolean@Nullable StringGets the class name of theLoggerContextFactoryimplementation of this Provider.Gets the priority (natural ordering) of this Provider.@Nullable StringGets the class name of theThreadContextMapimplementation of this Provider.@Nullable URLgetUrl()Deprecated.since 2.24.0, without a replacement.Returns the Log4j API versions supported by the implementation.inthashCode()@Nullable Class<? extends LoggerContextFactory>Loads theLoggerContextFactoryclass specified by this Provider.@Nullable Class<? extends ThreadContextMap>Loads theThreadContextMapclass specified by this Provider.toString()
- 
Field Details- 
CURRENT_VERSIONConstant inlined by the compiler- Since:
- 2.24.0
- See Also:
 
- 
FACTORY_PRIORITYDeprecated.since 2.24.0Property name to set for a Log4j 2 provider to specify the priority of this implementation.- Since:
- 2.0.1
- See Also:
 
- 
THREAD_CONTEXT_MAPDeprecated.since 2.24.0Property name to set to the implementation ofThreadContextMap.- Since:
- 2.0.1
- See Also:
 
- 
LOGGER_CONTEXT_FACTORYDeprecated.since 2.24.0Property name to set to the implementation ofLoggerContextFactory.- Since:
- 2.0.1
- See Also:
 
- 
PROVIDER_PROPERTY_NAMESystem property used to specify the class name of the provider to use.- Since:
- 2.24.0
- See Also:
 
 
- 
- 
Constructor Details- 
ProviderDeprecated.since 2.24.0Constructor used by the deprecatedMETA-INF/log4j-provider.propertiesformat.- Since:
- 2.0.1
 
- 
Provider- Parameters:
- priority- A positive number specifying the provider's priority or- nullif default,
- versions- Minimal API version required, should be set to- CURRENT_VERSION.
- Since:
- 2.24.0
 
- 
Providerpublic Provider(@Nullable Integer priority, String versions, @Nullable Class<? extends LoggerContextFactory> loggerContextFactoryClass) - Parameters:
- priority- A positive number specifying the provider's priority or- nullif default,
- versions- Minimal API version required, should be set to- CURRENT_VERSION,
- loggerContextFactoryClass- A public exported implementation of- LoggerContextFactoryor- nullif- getLoggerContextFactory()is also implemented.
- Since:
- 2.9.0
 
- 
Providerpublic Provider(@Nullable Integer priority, String versions, @Nullable Class<? extends LoggerContextFactory> loggerContextFactoryClass, @Nullable Class<? extends ThreadContextMap> threadContextMapClass) - Parameters:
- priority- A positive number specifying the provider's priority or- nullif default,
- versions- Minimal API version required, should be set to- CURRENT_VERSION,
- loggerContextFactoryClass- A public exported implementation of- LoggerContextFactoryor- nullif- getLoggerContextFactory()is also implemented,
- threadContextMapClass- A public exported implementation of- ThreadContextMapor- nullif- getThreadContextMapInstance()is implemented.
- Since:
- 2.9.0
 
 
- 
- 
Method Details- 
getVersionsReturns the Log4j API versions supported by the implementation.- Returns:
- A String containing the Log4j versions supported.
- Since:
- 2.9.0
 
- 
getPriorityGets the priority (natural ordering) of this Provider.Log4j selects the highest priority provider. - Returns:
- the priority of this Provider
 
- 
getClassNameGets the class name of theLoggerContextFactoryimplementation of this Provider.- Returns:
- the class name of a LoggerContextFactory implementation or nullif unspecified.
- See Also:
 
- 
loadLoggerContextFactoryLoads theLoggerContextFactoryclass specified by this Provider.- Returns:
- the LoggerContextFactory implementation class or nullif unspecified or a loader error occurred.
- Since:
- 2.0.1
 
- 
getLoggerContextFactory- Returns:
- The logger context factory to be used by LogManager.
- Since:
- 2.24.0
 
- 
getThreadContextMapGets the class name of theThreadContextMapimplementation of this Provider.- Returns:
- the class name of a ThreadContextMap implementation
 
- 
loadThreadContextMapLoads theThreadContextMapclass specified by this Provider.- Returns:
- the ThreadContextMapimplementation class ornullif unspecified or a loading error occurred.
- Since:
- 2.0.1
 
- 
getThreadContextMapInstance- Returns:
- The thread context map to be used by ThreadContext.
- Since:
- 2.24.0
 
- 
getUrlDeprecated.since 2.24.0, without a replacement.Gets the URL containing this Provider's Log4j details.- Returns:
- the URL corresponding to the Provider META-INF/log4j-provider.propertiesfile ornullfor a provider class.
 
- 
toString
- 
equals
- 
hashCodepublic int hashCode()
 
-