You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Remko Popma (JIRA)" <ji...@apache.org> on 2015/10/23 18:57:27 UTC

[jira] [Created] (LOG4J2-1172) ThreadLocal leak on Tomcat when using AsyncLoggerContextSelector

Remko Popma created LOG4J2-1172:
-----------------------------------

             Summary: ThreadLocal leak on Tomcat when using AsyncLoggerContextSelector
                 Key: LOG4J2-1172
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1172
             Project: Log4j 2
          Issue Type: Bug
          Components: Configurators, Web/Servlet
    Affects Versions: 2.4.1, 2.4, 2.5
            Reporter: Remko Popma


Tomcat warns at SEVERE level about a ThreadLocal leak (AsyncLogger$Info).

Steps to reproduce:
* Make all loggers async by using the AsyncLoggerContextSelector 
* Place the log4j jar files in the web app's WEB-INF/lib folder, and the configuration file in the class path or in a location configured in the web.xml
* Start the web app, trigger some logging, then stop the web app.

Tomcat will warn
{quote}
SEVERE: The web application \[webapp] created a ThreadLocal with key of type \[org.apache.logging.log4j.core.async.AsyncLogger$Info$1] (value \[org.apache.logging.log4j.core.async.AsyncLogger$Info$1@136a1c9]) and a value of type \[org.apache.logging.log4j.core.async.AsyncLogger.Info] (value \[org.apache.logging.log4j.core.async.AsyncLogger$Info@597fb9]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
{quote}

Note: as of log4j 2.5, {{Info}} is no longer an inner class of {{AsyncLogger}}, so the message may look slightly different.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org