Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Duplicate
-
2.11.1
-
None
-
None
-
Example config:
status = TRACE
dest = err
name = testconfigappender.message.type = RollingRandomAccessFile
appender.message.name = Message
appender.message.append = true
appender.message.immediateFlush = true
appender.message.filePattern = ${sys:user.home}/log/%d{MMddyyHH}00.Message.log
appender.message.layout.type = PatternLayout
appender.message.layout.pattern = %d{yyyy.MM.dd HH:mm:ss.sss} %p [%t] %m%ex%n%n
appender.message.policy.type = CronTriggeringPolicy
appender.message.policy.schedule = 0 0 * * * ?
appender.message.policy.evaluateOnStartup = true
appender.message.filter.threshold.type = ThresholdFilter
appender.message.filter.threshold.level = WARNING
appender.message.strategy.type = DirectWriteRolloverStrategy
appender.message.strategy.maxFiles = 999999rootLogger.level = ALL
rootLogger.includeLocation = false
rootLogger.appenderRef.message.ref = Message
Example config: status = TRACE dest = err name = testconfig appender.message.type = RollingRandomAccessFile appender.message.name = Message appender.message.append = true appender.message.immediateFlush = true appender.message.filePattern = ${sys:user.home}/log/%d{MMddyyHH}00.Message.log appender.message.layout.type = PatternLayout appender.message.layout.pattern = %d{yyyy.MM.dd HH:mm:ss.sss} %p [%t] %m%ex%n%n appender.message.policy.type = CronTriggeringPolicy appender.message.policy.schedule = 0 0 * * * ? appender.message.policy.evaluateOnStartup = true appender.message.filter.threshold.type = ThresholdFilter appender.message.filter.threshold.level = WARNING appender.message.strategy.type = DirectWriteRolloverStrategy appender.message.strategy.maxFiles = 999999 rootLogger.level = ALL rootLogger.includeLocation = false rootLogger.appenderRef.message.ref = Message
Description
In configuration where RollingRandomAccessFile appender is used together with DirectWriteRolloverStrategy strategy and no messages got logged in a session I'm getting NullPointerException when closing the application.
Exception call stack is:
2018-11-16 13:53:01,221 pool-1-thread-1 ERROR Caught exception executing shutdown hook null 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.LoggerContext.stop(LoggerContext.java:353)
at org.apache.logging.log4j.core.LoggerContext$1.run(LoggerContext.java:281)
at org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry$RegisteredCancellable.run(DefaultShutdownCallbackRegistry.java:109)
at org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry.run(DefaultShutdownCallbackRegistry.java:74)
at java.lang.Thread.run(Thread.java:745)
Attachments
Issue Links
- duplicates
-
LOG4J2-2418 NullPointerException when closing never used RollingRandomAccessFileAppender
- Closed
- links to