Hm, there&#39;s more trouble here then what first meets the eye.<div><br></div><div>Originally I thought that malicious MDC inheritance caused problems only if you were careless, and forgot to either clear or retain the MDC information when switching threads. But there are situations when you don&#39;t have any kind of control over the ThreadPool, or the Runnables and Callables that get executed on it.<div>
<br></div><div>Think of a third-party library that uses a java.util.Timer or java.util.concurrent.ThreadPoolExecutor behind an API that exposes none of the threading logic, so you don&#39;t have a way to call MDC.setContextMap() anywhere. In this case you will end up with polluted MDCs everywhere.</div>
<div><br></div><div>I&#39;ve created an issue for this:</div><div><a href="http://jira.qos.ch/browse/LBCLASSIC-272">http://jira.qos.ch/browse/LBCLASSIC-272</a></div><div><br></div><div><a href="http://jira.qos.ch/browse/LBCLASSIC-272"></a>Lorant<br>
<br><div class="gmail_quote">On Tue, May 31, 2011 at 10:52, Matthias Treydte <span dir="ltr">&lt;<a href="mailto:waldheinz@gmail.com">waldheinz@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hello,<br>
<div class="im"><br>
&gt; call chain. It was quite a nice surprise that MDC data automagically<br>
&gt; appeared in the log files because of the inheritance.<br>
<br>
</div>I absolutely agree it&#39;s a nice feature and helps to keep the code<br>
clean, just as it did for you. But I also think that Lóránt&#39;s and my<br>
objections are valid as well, if not simply because thread pools are<br>
so common. So having the possibility to turn it on/off would be pretty<br>
helpful. I think the &quot;wrong data is worse than no data&quot; argument is<br>
pretty strong.<br>
<br>
<br>
Kind regards,<br>
<div class="im">-Matthias<br>
<br>
--<br>
For a successful technology, reality must take precedence over public<br>
relations, for nature cannot be fooled. (R.P. Feynman)<br>
_______________________________________________<br>
</div><div><div></div><div class="h5">Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
<a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
</div></div></blockquote></div><br></div></div>