Log4j MDC Tomcat下报异常org.apache.log4j.helpers.ThreadLocalMap

时间:2022-07-18 02:31:06
严重: The web application [/qdgswx] created a ThreadLocal with key of type [org.apache.log4j.helpers.ThreadLocalMap] (value [org    .apache.log4j.helpers.ThreadLocalMap@4eb2bb3d]) and a value of type [java.util.Hashtable] (value [{logtype=, nsrsbh=117474X, openid=-gKek}]) but failed to remove it when the web application was stopped. This is very likely     to create a memory leak.

环境为:log4j-1.2.16,tomcat-6.0.37

这是Log4j-1.2.16的一个Bug,详见:https://bz.apache.org/bugzilla/show_bug.cgi?id=50486

解决方法:将Log4j换成1.2.17版就不会报以上异常。

下载地址:http://www.apache.org/dyn/closer.cgi/logging/log4j/1.2.17/log4j-1.2.17.tar.gz