[logback-dev] [JIRA] (LOGBACK-1351) MDC issue

QOS.CH (JIRA) noreply-jira at qos.ch
Thu Nov 9 22:34:00 CET 2017


Gael Lalire created LOGBACK-1351:
------------------------------------

             Summary: MDC issue
                 Key: LOGBACK-1351
                 URL: https://jira.qos.ch/browse/LOGBACK-1351
             Project: logback
          Issue Type: Bug
          Components: logback-classic
            Reporter: Gael Lalire
            Assignee: Logback dev list


After -LOGBACK-620-, the MDC map is no longer in InheritableThreadLocal.

So when you MDC.put on a thread if you create a new thread from it, the new thread will not receive the value.

I think the -LOGBACK-620- was about not copying the map on each thread creation but only when it the map is modified, but the lost of inherited value was unexpected.

If so replacing
{code:java}
final ThreadLocal<Map<String, String>> copyOnThreadLocal = new ThreadLocal<Map<String, String>>();{code}
by 
{code:java}
final ThreadLocal<Map<String, String>> copyOnThreadLocal = new InheritableThreadLocal<Map<String, String>>();{code}
will do the fix



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the logback-dev mailing list