Class ThreadContextDataInjector
- java.lang.Object
-
- org.apache.logging.log4j.core.impl.ThreadContextDataInjector
-
public class ThreadContextDataInjector extends java.lang.Object
ThreadContextDataInjector
contains a number of strategies for copying key-value pairs from the variousThreadContext
map implementations into aStringMap
. In the case of duplicate keys, thread context values overwrite configurationProperty
values.These are the default
ContextDataInjector
objects returned by theContextDataInjectorFactory
.- Since:
- 2.7
- See Also:
ThreadContext
,Property
,ReadOnlyStringMap
,ContextDataInjector
,ContextDataInjectorFactory
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ThreadContextDataInjector.ForCopyOnWriteThreadContextMap
TheContextDataInjector
used when the ThreadContextMap implementation is a copy-on-write StringMap-based data structure.static class
ThreadContextDataInjector.ForDefaultThreadContextMap
DefaultContextDataInjector
for the legacyMap<String, String>
-based ThreadContext (which is also the ThreadContext implementation used for web applications).static class
ThreadContextDataInjector.ForGarbageFreeThreadContextMap
TheContextDataInjector
used when the ThreadContextMap implementation is a garbage-free StringMap-based data structure.
-
Field Summary
Fields Modifier and Type Field Description static java.util.Collection<ContextDataProvider>
contextDataProviders
ContextDataProviders loaded via OSGi.private static Logger
LOGGER
private static java.util.List<ContextDataProvider>
SERVICE_PROVIDERS
-
Constructor Summary
Constructors Constructor Description ThreadContextDataInjector()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
copyProperties(java.util.List<Property> properties, StringMap result)
Copies key-value pairs from the specified property list into the specifiedStringMap
.private static java.util.List<ContextDataProvider>
getProviders()
private static java.util.List<ContextDataProvider>
getServiceProviders()
static void
initServiceProviders()
Deprecated.no-op
-
-
-
Field Detail
-
LOGGER
private static final Logger LOGGER
-
contextDataProviders
public static java.util.Collection<ContextDataProvider> contextDataProviders
ContextDataProviders loaded via OSGi.
-
SERVICE_PROVIDERS
private static final java.util.List<ContextDataProvider> SERVICE_PROVIDERS
-
-
Method Detail
-
initServiceProviders
@Deprecated public static void initServiceProviders()
Deprecated.no-opPreviously this method allowed ContextDataProviders to be loaded eagerly, now they are loaded when this class is initialized.
-
getServiceProviders
private static java.util.List<ContextDataProvider> getServiceProviders()
-
copyProperties
public static void copyProperties(java.util.List<Property> properties, StringMap result)
Copies key-value pairs from the specified property list into the specifiedStringMap
.- Parameters:
properties
- list of configuration properties, may benull
result
- theStringMap
object to add the key-values to. Must be non-null
.
-
getProviders
private static java.util.List<ContextDataProvider> getProviders()
-
-