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 Summary
Modifier and TypeFieldDescriptionprotected static final String
Constant inlined by the compilerstatic final String
Deprecated.since 2.24.0static final String
Deprecated.since 2.24.0static final String
System property used to specify the class name of the provider to use.static final String
Deprecated.since 2.24.0 -
Constructor Summary
ConstructorDescriptionProvider
(@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 Summary
Modifier and TypeMethodDescriptionboolean
@Nullable String
Gets the class name of theLoggerContextFactory
implementation of this Provider.Gets the priority (natural ordering) of this Provider.@Nullable String
Gets the class name of theThreadContextMap
implementation of this Provider.@Nullable URL
getUrl()
Deprecated.since 2.24.0, without replacement.Returns the Log4j API versions supported by the implementation.int
hashCode()
@Nullable Class<? extends LoggerContextFactory>
Loads theLoggerContextFactory
class specified by this Provider.@Nullable Class<? extends ThreadContextMap>
Loads theThreadContextMap
class specified by this Provider.toString()
-
Field Details
-
CURRENT_VERSION
Constant inlined by the compiler- See Also:
-
FACTORY_PRIORITY
Deprecated.since 2.24.0Property name to set for a Log4j 2 provider to specify the priority of this implementation.- See Also:
-
THREAD_CONTEXT_MAP
Deprecated.since 2.24.0Property name to set to the implementation ofThreadContextMap
.- See Also:
-
LOGGER_CONTEXT_FACTORY
Deprecated.since 2.24.0Property name to set to the implementation ofLoggerContextFactory
.- See Also:
-
PROVIDER_PROPERTY_NAME
System property used to specify the class name of the provider to use.- Since:
- 2.24.0
- See Also:
-
-
Constructor Details
-
Provider
Deprecated.since 2.24.0Constructor used by the deprecatedMETA-INF/log4j-provider.properties
format. -
Provider
- Parameters:
priority
- A positive number specifying the provider's priority ornull
if default,versions
- Minimal API version required, should be set toCURRENT_VERSION
.- Since:
- 2.24.0
-
Provider
public Provider(@Nullable Integer priority, String versions, @Nullable Class<? extends LoggerContextFactory> loggerContextFactoryClass) - Parameters:
priority
- A positive number specifying the provider's priority ornull
if default,versions
- Minimal API version required, should be set toCURRENT_VERSION
,loggerContextFactoryClass
- A public exported implementation ofLoggerContextFactory
ornull
ifgetLoggerContextFactory()
is also implemented.
-
Provider
public 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 ornull
if default,versions
- Minimal API version required, should be set toCURRENT_VERSION
,loggerContextFactoryClass
- A public exported implementation ofLoggerContextFactory
ornull
ifgetLoggerContextFactory()
is also implemented,threadContextMapClass
- A public exported implementation ofThreadContextMap
ornull
ifgetThreadContextMapInstance()
is implemented.
-
-
Method Details
-
getVersions
Returns the Log4j API versions supported by the implementation.- Returns:
- A String containing the Log4j versions supported.
-
getPriority
Gets the priority (natural ordering) of this Provider.Log4j selects the highest priority provider.
- Returns:
- the priority of this Provider
-
getClassName
Gets the class name of theLoggerContextFactory
implementation of this Provider.- Returns:
- the class name of a LoggerContextFactory implementation or
null
if unspecified. - See Also:
-
loadLoggerContextFactory
Loads theLoggerContextFactory
class specified by this Provider.- Returns:
- the LoggerContextFactory implementation class or
null
if unspecified or a loader error occurred.
-
getLoggerContextFactory
- Returns:
- The logger context factory to be used by
LogManager
. - Since:
- 2.24.0
-
getThreadContextMap
Gets the class name of theThreadContextMap
implementation of this Provider.- Returns:
- the class name of a ThreadContextMap implementation
-
loadThreadContextMap
Loads theThreadContextMap
class specified by this Provider.- Returns:
- the
ThreadContextMap
implementation class ornull
if unspecified or a loading error occurred.
-
getThreadContextMapInstance
- Returns:
- The thread context map to be used by
ThreadContext
. - Since:
- 2.24.0
-
getUrl
Deprecated.since 2.24.0, without replacement.Gets the URL containing this Provider's Log4j details.- Returns:
- the URL corresponding to the Provider
META-INF/log4j-provider.properties
file ornull
for a provider class.
-
toString
-
equals
-
hashCode
public int hashCode()
-