Class ThreadContextDataInjector
- java.lang.Object
-
- org.apache.logging.log4j.core.impl.ThreadContextDataInjector
-
public class ThreadContextDataInjector extends java.lang.ObjectThreadContextDataInjectorcontains a number of strategies for copying key-value pairs from the variousThreadContextmap implementations into aStringMap. In the case of duplicate keys, thread context values overwrite configurationPropertyvalues.These are the default
ContextDataInjectorobjects returned by theContextDataInjectorFactory.- Since:
- 2.7
- See Also:
ThreadContext,Property,ReadOnlyStringMap,ContextDataInjector,ContextDataInjectorFactory
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classThreadContextDataInjector.ForCopyOnWriteThreadContextMapTheContextDataInjectorused when the ThreadContextMap implementation is a copy-on-write StringMap-based data structure.static classThreadContextDataInjector.ForDefaultThreadContextMapDefaultContextDataInjectorfor the legacyMap<String, String>-based ThreadContext (which is also the ThreadContext implementation used for web applications).static classThreadContextDataInjector.ForGarbageFreeThreadContextMapTheContextDataInjectorused 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>contextDataProvidersContextDataProviders loaded via OSGi.private static LoggerLOGGERprivate 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 voidcopyProperties(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 voidinitServiceProviders()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 benullresult- theStringMapobject to add the key-values to. Must be non-null.
-
getProviders
private static java.util.List<ContextDataProvider> getProviders()
-
-