Package org.apache.logging.log4j.spi
Class ThreadContextMapFactory
- java.lang.Object
-
- org.apache.logging.log4j.spi.ThreadContextMapFactory
-
public final class ThreadContextMapFactory extends java.lang.ObjectCreates the ThreadContextMap instance used by the ThreadContext.If
Log4j can use ThreadLocals, a garbage-free StringMap-based context map can be installed by setting system propertylog4j2.garbagefree.threadContextMaptotrue.Furthermore, any custom
ThreadContextMapcan be installed by setting system propertylog4j2.threadContextMapto the fully qualified class name of the class implementing theThreadContextMapinterface. (Also implement theReadOnlyThreadContextMapinterface if your customThreadContextMapimplementation should be accessible to applications via theThreadContext.getThreadContextMap()method.)Instead of system properties, the above can also be specified in a properties file named
log4j2.component.propertiesin the classpath.- Since:
- 2.7
- See Also:
ThreadContextMap,ReadOnlyThreadContextMap,ThreadContext
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ThreadContextMapcreateThreadContextMap()
-
-
-
Method Detail
-
createThreadContextMap
public static ThreadContextMap createThreadContextMap()
-
-