The reproducer is:
A single bundle with single activator with start() method:
Changed logging configuration (added MDC key):
the activator checks for $KARAF_HOME/data/marker file and when found, logs its content and then removes it:
And in logs we can see:
After refreshing pax-logging-service:
We no longer see the key:
Looks like the most obvious solution is to reinitialize org.ops4j.pax.logging.slf4j.Slf4jMDCAdapter#m_context.
Handled with PAXLOGGING-252.
org.apache.log4j.MDC#getPaxContext, org.ops4j.pax.logging.log4jv2.Log4jv2ThreadContextMap#getContext() and org.ops4j.pax.logging.slf4j.Slf4jMDCAdapter#getContext always delegate to underlying PaxLoggingService (if there's one).