Class Provider
java.lang.Object
org.apache.logging.log4j.spi.Provider
- Direct Known Subclasses:
JULProvider, Log4jProvider, SimpleProvider, SLF4JProvider
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
FieldsModifier and TypeFieldDescriptionprivate final WeakReference<ClassLoader> Deprecated.private final @Nullable StringDeprecated.protected static final StringConstant inlined by the compilerprivate static final intprivate static final Stringprivate static final Stringstatic final StringDeprecated.since 2.24.0private static final Loggerstatic final StringDeprecated.since 2.24.0private final @Nullable Class<? extends LoggerContextFactory> private final intstatic final StringSystem property used to specify the class name of the provider to use.static final StringDeprecated.since 2.24.0private final @Nullable StringDeprecated.private final @Nullable Class<? extends ThreadContextMap> private final @Nullable URLDeprecated.private final @Nullable String -
Constructor Summary
ConstructorsConstructorDescriptionProvider(@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 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_VERSION
Constant inlined by the compiler- Since:
- 2.24.0
- See Also:
-
FACTORY_PRIORITY
Deprecated.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_MAP
Deprecated.since 2.24.0Property name to set to the implementation ofThreadContextMap.- Since:
- 2.0.1
- See Also:
-
LOGGER_CONTEXT_FACTORY
Deprecated.since 2.24.0Property name to set to the implementation ofLoggerContextFactory.- Since:
- 2.0.1
- See Also:
-
PROVIDER_PROPERTY_NAME
System property used to specify the class name of the provider to use.- Since:
- 2.24.0
- See Also:
-
DISABLE_CONTEXT_MAP
- See Also:
-
DISABLE_THREAD_CONTEXT
- See Also:
-
DEFAULT_PRIORITY
private static final int DEFAULT_PRIORITY- See Also:
-
LOGGER
-
priority
private final int priority -
className
Deprecated. -
loggerContextFactoryClass
-
threadContextMap
Deprecated. -
threadContextMapClass
-
versions
-
url
Deprecated. -
classLoader
Deprecated.
-
-
Constructor Details
-
Provider
Deprecated.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 ornullif 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 ornullif default,versions- Minimal API version required, should be set toCURRENT_VERSION,loggerContextFactoryClass- A public exported implementation ofLoggerContextFactoryornullifgetLoggerContextFactory()is also implemented.- Since:
- 2.9.0
-
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 ornullif default,versions- Minimal API version required, should be set toCURRENT_VERSION,loggerContextFactoryClass- A public exported implementation ofLoggerContextFactoryornullifgetLoggerContextFactory()is also implemented,threadContextMapClass- A public exported implementation ofThreadContextMapornullifgetThreadContextMapInstance()is implemented.- Since:
- 2.9.0
-
-
Method Details
-
getVersions
Returns the Log4j API versions supported by the implementation.- Returns:
- A String containing the Log4j versions supported.
- Since:
- 2.9.0
-
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 theLoggerContextFactoryimplementation of this Provider.- Returns:
- the class name of a LoggerContextFactory implementation or
nullif unspecified. - See Also:
-
loadLoggerContextFactory
Loads 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
-
getThreadContextMap
Gets the class name of theThreadContextMapimplementation of this Provider.- Returns:
- the class name of a ThreadContextMap implementation
-
loadThreadContextMap
Loads 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
-
getUrl
Deprecated.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
-
hashCode
-