[ 
https://issues.apache.org/jira/browse/LOG4J2-2760?focusedWorklogId=384141&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-384141
 ]

ASF GitHub Bot logged work on LOG4J2-2760:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Feb/20 21:21
            Start Date: 09/Feb/20 21:21
    Worklog Time Spent: 10m 
      Work Description: rgoers commented on pull request #332: LOG4J2-2760: 
Fixes RollingFileAppender with DirectWriteRolloverStrategy and HtmlLayout
URL: https://github.com/apache/logging-log4j2/pull/332#discussion_r376753729
 
 

 ##########
 File path: 
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/OutputStreamManager.java
 ##########
 @@ -164,6 +164,7 @@ public boolean hasOutputStream() {
     protected OutputStream getOutputStream() throws IOException {
         if (outputStream == null) {
             outputStream = createOutputStream();
+            setOutputStream(outputStream); // Needed so the header will be 
written
 
 Review comment:
   It seems like this should be
   ```
       if (outputSteam == null) {
           setOutputStream(createOutputStream);
   ```
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 384141)
    Time Spent: 0.5h  (was: 20m)

> RollingFileAppender with DirectWriteRolloverStrategy does not work with 
> HtmlLayout
> ----------------------------------------------------------------------------------
>
>                 Key: LOG4J2-2760
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2760
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>            Reporter: Christoph Kaser
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> 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:
> {noformat}
> 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){noformat}
> I will create a PR in github with a TestCase and a fix and attach it to this 
> bug report.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to