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

log4j.shutdownHookEnabled=false from log4j-web ignored?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.3
    • None
    • Web/Servlet
    • None

    Description

      In the documentation it says for the System Property 'log4j.shutdownHookEnabled':

      Overrides the global flag for whether or not a shutdown hook should be used to stop a LoggerContext. By default, this is enabled and can be disabled on a per-configuration basis. When running with the log4j-web module, this is automatically disabled.

      I included the log4j-web module into my Maven project so the shutdown hook should be disabled. During initialization I can see in the debug messages that this is not the case:

      DEBUG Starting LoggerContext[name=31484215] from configuration at null
      DEBUG Starting LoggerContext[name=31484215, org.apache.logging.log4j.core.LoggerContext@1836523] with configuration XmlConfiguration[location=C:\app\apache-tomcat-8.0.24\wtpwebapps\webapp\WEB-INF\classes\log4j2.xml]...
      DEBUG Shutdown hook enabled. Registering a new one.
      DEBUG Starting configuration XmlConfiguration[location=C:\app\apache-tomcat-8.0.24\wtpwebapps\webapp\WEB-INF\classes\log4j2.xml]
      [...]

      During shutdown (more specifically the contextDestroyed method of the ServletContextListener) I try to log some messages but the Logger is already shut down and therefore swallows all log messages (see LOG4J2-658).

      Do I need to do something else to disable the shutdown hook?

      Attachments

        Activity

          People

            Unassigned Unassigned
            jansohn Robin Jansohn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: