Adding the slf4j-propagation
jar to your classpath
is all that is needed to let the Mapped Diagnostic Context (MDC)
from the Simple Logging Facade for Java (SLF4J)
be automatically included into the ContextSnapshot
.
Add it to your classpath.
<dependency>
<groupId>nl.talsmasoftware.context</groupId>
<artifactId>slf4j-propagation</artifactId>
<version>[see Maven badge above]</version>
</dependency>
Done!
Now the MDC.getCopyOfContextMap()
is copied into each snapshot
from the ContextSnapshot.capture()
method
to be reactivated by the Contextsnapshot.reactivate()
call.
The ContextAwareExecutorService
automatically propagates the full MDC content
into all executed tasks this way.