logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Bernhagen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-1833) NullPointerException using fileName property of RollingFile Appender with DirectWriteRolloverStrategy
Date Mon, 27 Mar 2017 15:03:41 GMT

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

Andrew Bernhagen commented on LOG4J2-1833:
------------------------------------------

I am also encountering this error.

> 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
>            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.3.15#6346)

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


Mime
View raw message