Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1172

ThreadLocal leak [AsyncLogger$Info] on Tomcat when using AsyncLoggerContextSelector

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4, 2.4.1, 2.5
    • Fix Version/s: 2.5
    • Component/s: Configurators, Web/Servlet
    • Labels:
      None

      Description

      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

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                remkop@yahoo.com Remko Popma
                Reporter:
                remkop@yahoo.com Remko Popma
              • Votes:
                1 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: