You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2017/08/23 13:28:00 UTC
[jira] [Commented] (LOG4J2-1833) NullPointerException using
fileName property of RollingFile Appender with DirectWriteRolloverStrategy
[ https://issues.apache.org/jira/browse/LOG4J2-1833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16138335#comment-16138335 ]
ASF subversion and git services commented on LOG4J2-1833:
---------------------------------------------------------
Commit 915e681e5e2bc3ad3f2eaeff9d10d38a07ef277c in logging-log4j2's branch refs/heads/master from [~ralph_goers@dslextreme.com]
[ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=915e681 ]
LOG4J2-1833 - Log an error message if a file name is specified with the DirectWriteRolloverStrategy
> NullPointerException using fileName property of RollingFile Appender with DirectWriteRolloverStrategy
> -----------------------------------------------------------------------------------------------------
>
> Key: LOG4J2-1833
> URL: https://issues.apache.org/jira/browse/LOG4J2-1833
> Project: Log4j 2
> Issue Type: Bug
> Affects Versions: 2.8.1
> Environment: Windows 7 64-bit JDK 8
> Reporter: Austin Huck
> Assignee: Ralph Goers
> Priority: Minor
>
> When using a {{RollingFileAppender}} with a {{DirectWriteRolloverStrategy}} if the _fileName_ property of the appender is set, rollover fails with a {{NullPointerException}}. If the _fileName_ attribute is not present logging works as intended.
> Configuration that produces this error:
> {code:title=log4j2.xml|borderStyle=solid}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="warn" name="MyApp" packages="">
> <Properties>
> <Property name="baseDir">C:/logs</Property>
> </Properties>
> <Appenders>
> <RollingFile name="RollingFile" fileName="${baseDir}/app.log"
> filePattern="${baseDir}/app-%d{yyyy-MM-dd'T'HH_mm_ss}.log">
> <PatternLayout pattern="%d %p %c{1.} [%t] %m%n" />
> <TimeBasedTriggeringPolicy interval="10"/>
> <DirectWriteRolloverStrategy>
> <Delete basePath="${baseDir}">
> <IfFileName glob="app-*.log" />
> <IfAccumulatedFileCount exceeds="10" />
> </Delete>
> </DirectWriteRolloverStrategy>
> </RollingFile>
> </Appenders>
> <Loggers>
> <Root level="trace">
> <AppenderRef ref="RollingFile"/>
> </Root>
> </Loggers>
> </Configuration>
> {code}
> Stack Trace:
> {noformat}
> 2017-03-02 13:38:52,023 main ERROR An exception occurred processing Appender RollingFile java.lang.NullPointerException: activeFileName
> at java.util.Objects.requireNonNull(Objects.java:228)
> at org.apache.logging.log4j.core.appender.rolling.RolloverDescriptionImpl.<init>(RolloverDescriptionImpl.java:60)
> at org.apache.logging.log4j.core.appender.rolling.DirectWriteRolloverStrategy.rollover(DirectWriteRolloverStrategy.java:194)
> at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.rollover(RollingFileManager.java:362)
> at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.rollover(RollingFileManager.java:278)
> at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.checkRollover(RollingFileManager.java:218)
> at org.apache.logging.log4j.core.appender.RollingFileAppender.append(RollingFileAppender.java:267)
> at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156)
> at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129)
> at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120)
> at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
> at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:448)
> at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:433)
> at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417)
> at org.apache.logging.log4j.core.config.LoggerConfig.logParent(LoggerConfig.java:439)
> at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:434)
> at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417)
> at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:403)
> at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63)
> at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146)
> at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2091)
> at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1993)
> at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1852)
> at org.apache.logging.slf4j.Log4jLogger.error(Log4jLogger.java:299)
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)