public class ContextDataInjectorFactory extends Object
ContextDataInjector
instance based on the value of system
property log4j2.ContextDataInjector
. Users may use this system property to specify the fully qualified class
name of a class that implements the ContextDataInjector
interface.
If no value was specified this factory method returns one of the injectors defined in
ThreadContextDataInjector
.ContextDataInjector
,
ReadOnlyStringMap
,
ThreadContextDataInjector
,
LogEvent.getContextData()
Constructor and Description |
---|
ContextDataInjectorFactory() |
Modifier and Type | Method and Description |
---|---|
static ContextDataInjector |
createInjector()
Returns a new
ContextDataInjector instance based on the value of system property
log4j2.ContextDataInjector . |
public ContextDataInjectorFactory()
public static ContextDataInjector createInjector()
ContextDataInjector
instance based on the value of system property
log4j2.ContextDataInjector
. If no value was specified this factory method returns one of the
ContextDataInjector
classes defined in ThreadContextDataInjector
which is most appropriate for
the ThreadContext implementation.
Note: It is no longer recommended that users provide a custom implementation of the ContextDataInjector.
Instead, provide a ContextDataProvider
.
Users may use this system property to specify the fully qualified class name of a class that implements the
ContextDataInjector
interface.
When providing a custom ContextDataInjector
, be aware that this method may be invoked multiple times by
the various components in Log4j that need access to context data.
This includes the object(s) that populate log events, but also various lookups and filters that look at
context data to determine whether an event should be logged.
ReadOnlyStringMap
of all LogEvent
objectsLogEvent.getContextData()
,
ContextDataInjector
Copyright © 1999-2021 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.