<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 9 March 2015 at 22:37, Ceki Gülcü <span dir="ltr"><<a href="mailto:ceki@qos.ch" target="_blank">ceki@qos.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">MDC is a thread-wide structure. At present time, it cannot be set per logging event. Any changes you make to the mdcPropertyMap (retrieved by calling event.getMDCPropertyMap()) will be visible to all future events generated in the same thread.</blockquote></div><div class="gmail_extra"><br></div>Please forgive my ignorance if I say something wrong.</div><div class="gmail_extra"><br></div><div class="gmail_extra">ch.qos.logback.classic.spi.LoggingEvent#getMDCPropertyMap returns:</div><div class="gmail_extra"><br></div><div class="gmail_extra">1. If MDCAdapter has an already property map, It returns this map</div><div class="gmail_extra">2. If MDCAdapter has not a map, it returns a static map(CACHED_NULL_MAP) which is shared among other threads as well. If I set it mistakenly, It will be used by other threads.  </div><div class="gmail_extra"><br></div><div class="gmail_extra">This parts seems a little bid problematic.  I just want to share same map reference between event and MDCAdapter which will let me:</div><div class="gmail_extra"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br><span style="color:rgb(80,0,80);font-size:12.8000001907349px">    public  FilterReply decide(ILoggingEvent event) {<br></span><span style="color:rgb(80,0,80);font-size:12.8000001907349px">       if  (event.getLevel().</span><u style="color:rgb(80,0,80);font-size:12.8000001907349px"></u><span style="color:rgb(80,0,80);font-size:12.8000001907349px">isGreaterOrE</span><span style="color:rgb(80,0,80);font-size:12.8000001907349px">qual(Level.WARN)) {<br></span><span style="color:rgb(80,0,80);font-size:12.8000001907349px">          MDC.put("demo","demo");<br></span><span style="color:rgb(80,0,80);font-size:12.8000001907349px">       }<br></span><span style="color:rgb(80,0,80);font-size:12.8000001907349px">       return  FilterReply.ACCEPT;<br></span><span style="color:rgb(80,0,80);font-size:12.8000001907349px">    }</span></blockquote><div class="gmail_extra"> </div><div class="gmail_extra">Also I am expecting to be cleared in case a MDC.remove call. What do you think?</div><div class="gmail_extra"><br></div></div>