You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Florin Marinoiu (JIRA)" <ji...@apache.org> on 2014/09/02 16:35:20 UTC

[jira] [Comment Edited] (LOG4J2-807) Disruptor is null when configuration is reloaded (asyncRoot + monitorInterval)

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

Florin Marinoiu edited comment on LOG4J2-807 at 9/2/14 2:35 PM:
----------------------------------------------------------------

The FileConfigurationMonitor is restarting config on another Thread, The disruptor is null in the AsyncLoggerConfigHelper and logs to status logger:
{code}
2014-09-02 09:24:09,779 FATAL Ignoring log event after log4j was shut down
2014-09-02 09:24:10,779 FATAL Ignoring log event after log4j was shut down
2014-09-02 09:24:11,779 FATAL Ignoring log event after log4j was shut down
{code}
after reconfiguration.


was (Author: florin.marinoiu):
The FileConfigurationMonitor is restarting config on another Thread, I guess that's why the disruptor is null in the AsyncLoggerConfigHelper and logs to status logger:
{code}
2014-09-02 09:24:09,779 FATAL Ignoring log event after log4j was shut down
2014-09-02 09:24:10,779 FATAL Ignoring log event after log4j was shut down
2014-09-02 09:24:11,779 FATAL Ignoring log event after log4j was shut down
{code}
after reconfiguration.

> Disruptor is null when configuration is reloaded (asyncRoot + monitorInterval)
> ------------------------------------------------------------------------------
>
>                 Key: LOG4J2-807
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-807
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.0.2
>            Reporter: Florin Marinoiu
>         Attachments: async-root-reload - trace.log, async-root-reload-test.zip, async-root-reload.log
>
>
> We have a XML configuration with <asyncRoot> and monitorInterval. When the configuration file is reloaded I have a NPE and log4j become unavailable:
> {code}
> 2014-08-29 10:39:59,079 ERROR Could not register mbeans java.lang.NullPointerException
> 	at org.apache.logging.log4j.core.async.AsyncLoggerConfigHelper.createRingBufferAdmin(AsyncLoggerConfigHelper.java:360)
> 	at org.apache.logging.log4j.core.async.AsyncLoggerConfig.createRingBufferAdmin(AsyncLoggerConfig.java:148)
> {code}
> Here is my config:
> {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration name="asynRootConfig" monitorInterval="5" status="debug">
>     <Appenders>
>         <RandomAccessFile name="FILE_APPENDER" fileName="application.log" immediateFlush="false" append="true">
>             <PatternLayout>
>                 <Pattern>%d  %-5p [%c{1.}] %m%n</Pattern>
>             </PatternLayout>
>         </RandomAccessFile>
>     </Appenders>
>     <Loggers>
>         <asyncRoot level="debug">
>             <AppenderRef ref="FILE_APPENDER" />
>         </asyncRoot>
>     </Loggers>
> </Configuration>
> {code}
> And a code snippet to reproduce:
> {code}
> public class Log4jAsyncRootReloadTest {
>     public static void main(String[] args) throws InterruptedException {
>         final File config = new File("./log4j2.xml");
>         System.setProperty("log4j.configurationFile", "file://" + config.getAbsolutePath().replaceAll("\\\\", "/"));
>         Logger logger = LogManager.getLogger(Log4jAsyncRootReloadTest.class);
>         logger.info("Log4j configured, will be reconfigured in aprox. 5 sec");
>         config.setLastModified(System.currentTimeMillis());
>         for (int i = 0; i < 10; i++) {
>             Thread.sleep(1000);
>             logger.info("Log4j waiting for reconfiguration");
>         }
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org