[Bug 133] New: MDC content is not copied to child threads

http://bugzilla.qos.ch/show_bug.cgi?id=133 Summary: MDC content is not copied to child threads Product: logback-classic Version: unspecified Platform: All OS/Version: All Status: NEW Severity: critical Priority: P1 Component: Other AssignedTo: logback-dev@qos.ch ReportedBy: mfranz@intershop.de I havn't found neither at slf4j nor logback pages any information if a child thread inherits the MDC content of its parent thread when it is created. The log4j Javadoc of the MDC class states: "The MDC is managed on a per thread basis. A child thread automatically inherits a copy of the mapped diagnostic context of its parent." But with logback 0.9.8 the MDC is always empty for a new thread. Is there a reason for that? Within my application it only make sense if the child thread MDC is initially filled with content of the parent thread. Also for users of the log4j MDC this might be a critical issue preventing them from switching to logback. The LogbackMDCAdapter can easily be changed to achieve the inheriting feature: public class LogbackMDCAdapter implements MDCAdapter { private final InheritableThreadLocal<HashMap<String, String>> threadLocal = new InheritableThreadLocal<HashMap<String, String>>() { @Override @SuppressWarnings("unchecked") protected HashMap<String, String> childValue(HashMap<String, String> parentValue) { return (parentValue!=null) ? (HashMap<String, String>)parentValue.clone() : null; } }; ... } -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=133 noreply.ceki@qos.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE ------- Comment #1 from noreply.ceki@qos.ch 2008-03-04 18:46 ------- Hello Michael, Thanks for your report. It is actually a duplicate of bug #64. *** This bug has been marked as a duplicate of bug 64 *** -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.

http://bugzilla.qos.ch/show_bug.cgi?id=133 mfranz@intershop.de changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED -- Configure bugmail: http://bugzilla.qos.ch/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
participants (1)
-
bugzilla-daemon@pixie.qos.ch