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

On changing of log4j2.xml, the CustomConfig and Factory are not called and custom loggers are lost

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.8.2
    • Fix Version/s: None
    • Component/s: Configurators
    • Labels:
      None
    • Environment:

      window 2012 server and Java 8

      Description

      We created Custom Configuration(Log4JConfiguration) and Factory by following the guide- https://logging.apache.org/log4j/2.x/manual/customconfig.html : Initialize Log4j by Combining Configuration File with Programmatic Configuration,
      On application initialization, everything works ok and log events are logged to custom logger file, but on changing of log4j2.xml file which is set to monitorInterval="10", Custom Log4JConfiguration is not called

      2017-05-17 11:21:33,459 localhost-startStop-1 DEBUG Configuration Log4JConfiguration[location=C:\Program Files\test\webapp\WEB-INF\classes\log4j2.xml] initialized
      2017-05-17 11:21:33,474 localhost-startStop-1 DEBUG Starting configuration Log4JConfiguration[location=C:\Program Files\test\webapp\WEB-INF\classes\log4j2.xml]
      2017-05-17 11:21:33,474 localhost-startStop-1 DEBUG Log4j2 ConfigurationScheduler starting 1 threads
      2017-05-17 11:21:33,474 localhost-startStop-1 DEBUG Started configuration Log4JConfiguration[location=C:\Program Files\test\webapp\WEB-INF\classes\log4j2.xml] OK.
      2017-05-17 11:21:33,474 localhost-startStop-1 TRACE Stopping Log4JConfiguration[location=C:\Program Files\test\webapp\WEB-INF\classes\log4j2.xml]...
      2017-05-17 11:21:33,474 localhost-startStop-1 TRACE Log4JConfiguration notified 6 ReliabilityStrategies that config will be stopped.
      2017-05-17 11:21:33,490 localhost-startStop-1 TRACE Log4JConfiguration stopping 5 LoggerConfigs.
      2017-05-17 11:21:33,490 localhost-startStop-1 TRACE Log4JConfiguration stopping root LoggerConfig.
      2017-05-17 11:21:33,490 localhost-startStop-1 TRACE Log4JConfiguration notifying ReliabilityStrategies that appenders will be stopped.
      2017-05-17 11:21:33,490 localhost-startStop-1 TRACE Log4JConfiguration stopping remaining Appenders.
      2017-05-17 11:21:33,490 localhost-startStop-1 DEBUG Shutting down OutputStreamManager SYSTEM_OUT.false.false
      2017-05-17 11:21:33,505 localhost-startStop-1 DEBUG Shut down OutputStreamManager SYSTEM_OUT.false.false, all resources released: true
      2017-05-17 11:21:33,505 localhost-startStop-1 DEBUG Appender STDOUT stopped with status true
      2017-05-17 11:21:33,521 localhost-startStop-1 TRACE Log4JConfiguration stopped 1 remaining Appenders.
      2017-05-17 11:21:33,521 localhost-startStop-1 TRACE Log4JConfiguration cleaning Appenders from 6 LoggerConfigs.
      2017-05-17 11:21:33,537 localhost-startStop-1 DEBUG Log4j2 ConfigurationScheduler shutting down threads in java.util.concurrent.ScheduledThreadPoolExecutor@21910699[Running, pool size = 1, active threads = 0, queued tasks = 1, completed tasks = 2]
      2017-05-17 11:21:33,724 localhost-startStop-1 DEBUG Stopped Log4JConfiguration[location=C:\Program Files\test\webapp\WEB-INF\classes\log4j2.xml] OK
      2017-05-17 11:21:33,740 localhost-startStop-1 TRACE Reregistering MBeans after reconfigure. Selector=org.apache.logging.log4j.core.selector.ClassLoaderContextSelector@26c1ae2f
      2017-05-17 11:21:33,755 localhost-startStop-1 TRACE Reregistering context (1/1): '4a7b56ff' org.apache.logging.log4j.core.LoggerContext@6b8e531c
      2017-05-17 11:21:33,755 localhost-startStop-1 TRACE Unregistering 1 MBeans: [org.apache.logging.log4j2:type=4a7b56ff]
      2017-05-17 11:21:33,755 localhost-startStop-1 TRACE Unregistering 1 MBeans: [org.apache.logging.log4j2:type=4a7b56ff,component=StatusLogger]
      2017-05-17 11:21:33,755 localhost-startStop-1 TRACE Unregistering 1 MBeans: [org.apache.logging.log4j2:type=4a7b56ff,component=ContextSelector]
      2017-05-17 11:21:33,771 localhost-startStop-1 TRACE Unregistering 5 MBeans: [org.apache.logging.log4j2:type=4a7b56ff,component=Loggers,name=org.apache.catalina, org.apache.logging.log4j2:type=4a7b56ff,component=Loggers,name=, org.apache.logging.log4j2:type=4a7b56ff,component=Loggers,name=org.springf
      ramework, org.apache.logging.log4j2:type=4a7b56ff,component=Loggers,name=org.apache.commons.digester.Digester, org.apache.logging.log4j2:type=4a7b56ff,component=Loggers,name=org.apache.commons.beanutils]
      2017-05-17 11:21:33,771 localhost-startStop-1 TRACE Unregistering 1 MBeans: [org.apache.logging.log4j2:type=4a7b56ff,component=Appenders,name=STDOUT]
      2017-05-17 11:21:33,771 localhost-startStop-1 TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=4a7b56ff,component=AsyncAppenders,name=*'
      2017-05-17 11:21:33,771 localhost-startStop-1 TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=4a7b56ff,component=AsyncLoggerRingBuffer'
      2017-05-17 11:21:33,787 localhost-startStop-1 TRACE Unregistering but no MBeans found matching 'org.apache.logging.log4j2:type=4a7b56ff,component=Loggers,name=*,subtype=RingBuffer'
      2017-05-17 11:21:33,787 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=4a7b56ff
      2017-05-17 11:21:33,787 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=4a7b56ff,component=StatusLogger
      2017-05-17 11:21:33,802 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=4a7b56ff,component=ContextSelector
      2017-05-17 11:21:33,802 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=4a7b56ff,component=Loggers,name=org.apache.commons.beanutils
      2017-05-17 11:21:33,802 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=4a7b56ff,component=Loggers,name=
      2017-05-17 11:21:33,818 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=4a7b56ff,component=Loggers,name=org.apache.catalina
      2017-05-17 11:21:33,880 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=4a7b56ff,component=Loggers,name=org.springframework
      2017-05-17 11:21:33,880 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=4a7b56ff,component=Loggers,name=com.entrust
      2017-05-17 11:21:33,896 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=4a7b56ff,component=Loggers,name=org.apache.commons.digester.Digester
      2017-05-17 11:21:33,896 localhost-startStop-1 DEBUG Registering MBean org.apache.logging.log4j2:type=4a7b56ff,component=Appenders,name=file
      2017-05-17 11:21:33,912 localhost-startStop-1 TRACE Using DummyNanoClock for nanosecond timestamps.
      2017-05-17 11:21:33,912 localhost-startStop-1 DEBUG Reconfiguration complete for context[name=4a7b56ff] at URI C:\Program Files\test\webapp\WEB-INF\classes\log4j2.xml (org.apache.logging.log4j.core.LoggerContext@6b8e531c) with optional ClassLoader: null

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              michaelbpeng michael peng
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: