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

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

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.4, 2.4.1, 2.5
    • 2.5
    • Configurators, Web/Servlet
    • 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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            rpopma Remko Popma
            rpopma Remko Popma
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment