Description
When I try to use the RollingFileAppender with a DirectWriteRolloverStrategy and a HtmlLayout, I encountered a bug: The first file that is written does not start with the header from the layout.
If I try to specify append=false to work around that issue, I encountered a NullPointerException instead:
java.lang.NullPointerException at java.io.File.<init>(File.java:277) at org.apache.logging.log4j.core.appender.FileManager.createOutputStream(FileManager.java:140) at org.apache.logging.log4j.core.appender.OutputStreamManager.getOutputStream(OutputStreamManager.java:166) at org.apache.logging.log4j.core.appender.OutputStreamManager.<init>(OutputStreamManager.java:95) at org.apache.logging.log4j.core.appender.FileManager.<init>(FileManager.java:72) at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.<init>(RollingFileManager.java:98) at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:627) at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:588) at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:113) at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114) at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:163) at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:142)
I will create a PR in github with a TestCase and a fix and attach it to this bug report.
Attachments
Issue Links
- is duplicated by
-
LOG4J2-2778 Using header in PatternLayout with DirectWriteRolloverStrategy
- Resolved
- links to