[logback-user] MDC.clear() invoked in child class deletes parent keys

Kuu kuu.kuu at gmail.com
Wed Feb 10 10:21:08 UTC 2016


I found an issue using the MDC. I have a filter that does the following:

MDC.put("key", value);
filterChain.doFilter(request, response);
value = MDC.get("key");

And the value is empty.

 The problem comes because a child controller class does:

... some logic....

And that call deletes all the content of the map. The problem is that the
child class does not check if the MDC contains something. Of course this
could be considered as a bad practice, but this "clear()" method is too
risky as it deletes ALL, even the parent keys...

I found this ticket : http://jira.qos.ch/browse/LOGBACK-325
it seems to be resolved.

The version I'm using is the loback-classic 1.1.2

Let me know if you need more information. Thank you.

Best Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20160210/bfbe9343/attachment.html>

More information about the logback-user mailing list