[ 
https://issues.apache.org/jira/browse/LOG4J2-1910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16055395#comment-16055395
 ] 

Pierrick HYMBERT commented on LOG4J2-1910:
------------------------------------------

You may register a 
{{org.apache.logging.log4j.core.config.ConfigurationListener}} in your custom 
configuration by calling 
{{org.apache.logging.log4j.core.config.AbstractConfiguration.addListener(ConfigurationListener)}}
 within doConfigure method, then you will be notified when the file changed and 
apply again your programatic configuration.

> On changing of log4j2.xml, the CustomConfig and Factory are not called and 
> custom loggers are lost 
> ---------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-1910
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1910
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Configurators
>    Affects Versions: 2.8.2
>         Environment: window 2012 server and Java 8
>            Reporter: michael peng
>
> 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



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to