[logback-dev] MDC/ThreadLocal not being cleared properely?

Marcel Stör marcel at frightanic.com
Mon Oct 18 21:55:13 CEST 2010

On 18.10.10 12:57, Marcel Stör wrote:
> I'm wondering whether slf4j/logback (potentially) suffers from the same
> problems as log4j:
> http://www.mail-archive.com/log4j-user@logging.apache.org/msg11921.html
> http://www.mail-archive.com/log4j-dev@logging.apache.org/msg11378.html
> I'd switch from slf4j/log4j to slf4j/logback if this solved the issue.
> [Abstract]
> If you don't want to go through the above referenced posts...
> According to Tomcat's (>=6.0.24) "memory leak detection" listener the
> log4j MDC has a memory leak: "A web application created a ThreadLocal
> with key of type (...) and a value of type (...) but failed to remove it
> when the web application was stopped." That's because log4j doesn't
> provide something like ThreadLocal#remove.

By coincidence (i.e. because there was activity there) I noticed that 
http://jira.qos.ch/browse/LBCLASSIC-183 deals with this exact issue.
Looks like logback will provide a fix - in contrast to log4j.

Marcel Stör, http://www.frightanic.com
Couchsurfing: http://www.couchsurfing.com/people/marcelstoer
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

More information about the logback-dev mailing list