You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2018/08/23 13:49:00 UTC

[jira] [Commented] (LOG4J2-2418) NullPointerException when closing never used RollingRandomAccessFileAppender

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

ASF subversion and git services commented on LOG4J2-2418:
---------------------------------------------------------

Commit 4d4743b7c88cd99d143972bbbfb10026b7782972 in logging-log4j2's branch refs/heads/release-2.x from [~garydgregory]
[ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=4d4743b ]

[LOG4J2-2418] NullPointerException when closing never used
RollingRandomAccessFileAppender.

> NullPointerException when closing never used RollingRandomAccessFileAppender
> ----------------------------------------------------------------------------
>
>                 Key: LOG4J2-2418
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2418
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.10.0, 2.11.1
>            Reporter: Jonas Rutishauser
>            Priority: Major
>
> If a {{RollingRandomAccessFileAppender}} is configured using the {{DirectWriteRolloverStrategy}} and there is no log event which is passed to this appender there will be a {{NullPointerException}} when the configuration is stoped.
> {code:java}
> java.lang.NullPointerException
> at org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager.closeOutputStream(RollingRandomAccessFileManager.java:168)
> at org.apache.logging.log4j.core.appender.OutputStreamManager.releaseSub(OutputStreamManager.java:136)
> at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.releaseSub(RollingFileManager.java:266)
> at org.apache.logging.log4j.core.appender.AbstractManager.stop(AbstractManager.java:86)
> at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.stop(AbstractOutputStreamAppender.java:142)
> at org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender.stop(RollingRandomAccessFileAppender.java:223)
> at org.apache.logging.log4j.core.config.AbstractConfiguration.stop(AbstractConfiguration.java:360)
> at org.apache.logging.log4j.core.AbstractLifeCycle.stop(AbstractLifeCycle.java:136)
> at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:552)
> at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:619)
> at org.apache.logging.log4j.core.LoggerContext.setConfigLocation(LoggerContext.java:605)
> at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:157)
> at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:70)
> at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:228)
> at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:158)
> at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:131)
> at org.apache.logging.log4j.core.config.Configurator.initialize(Configurator.java:101)
> at org.apache.logging.log4j.junit.LoggerContextRule$1.evaluate(LoggerContextRule.java:120)
> at org.junit.rules.RunRules.evaluate(RunRules.java:20)
> [...]
> {code}
> To reproduce the issue a config may be created wich does not use this appender:
> {code:xml}
> <Configuration status="WARN">
>  <Appenders>
>   <Console name="Console" target="SYSTEM_OUT"></Console>
>   <RollingRandomAccessFile name="DatedLogFile" filePattern="log.%d{yyyyMMdd}" immediateFlush="false">
>    <TimeBasedTriggeringPolicy />
>    <DirectWriteRolloverStrategy />
>   </RollingRandomAccessFile>
>  </Appenders>
>  <Loggers>
>   <Root level="warn">
>    <AppenderRef ref="Console" />
>   </Root>
>  </Loggers>
> </Configuration>
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)