Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2760

RollingFileAppender with DirectWriteRolloverStrategy does not work with HtmlLayout

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.13.1
    • Component/s: Appenders
    • Labels:
      None

      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

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              christophk Christoph Kaser

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m

                  Issue deployment