logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 11446] New: - Rolling, DailyRolling & FileAppender do not append Footer to each file
Date Sat, 03 Aug 2002 17:46:45 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11446>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11446

Rolling, DailyRolling & FileAppender do not append Footer to each file

           Summary: Rolling, DailyRolling & FileAppender do not append
                    Footer to each file
           Product: Log4j
           Version: 1.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Appender
        AssignedTo: log4j-dev@jakarta.apache.org
        ReportedBy: apache-bugs@thebap.org


Rolling, DailyRolling & FileAppender do not append layout footer to each file

The RollingFileAppender, DailyRollingFileAppender and FileAppender only append 
the footer to the last file, i.e. the file that is open when the appender is 
closed. This is due to an interaction between the FileAppender and the 
WriterAppender.

Typicaly FileAppender is only used to append to one file, therefore the 
problem does not become apparent, however it is posible to call setFile() on 
the FileAppender which would demonstrate the issue.

The RollingFileAppender & DailyRollingFileAppender commonly create multiple 
log files. When these appenders open a new file using FileAppender.setFile() 
method the Header is written into the file. When these appenders roll to the 
next file they call FileAppender.closeFile().

FileAppender.closeFile() does not write the Footer! Therefore each log file 
rolled by the appender does not have a footer written to it.

The Footer is written when the appender is closed, and that is done in the 
WriterAppender.close() method. This is incorrect as the writer can be set 
multiple times on the WriterAppender and the header and footer should be 
symetrical for the writer not for the appender.

The following are the changes I had to make to correct this behaviour in 
log4net:

In the WriterAppender the reset() method should write the footer rather than 
the close() method (close() calls reset() so this does not change the 
behaviour when closing, but does mean that the footer will be written when a 
reset occurs). This should be done because the setWriter() method calls reset
() to close the old writer and then calls writeHeader() to write the header 
into the new writer. To keep things consistant the reset() call should write 
the footer into the old writer.

In FileAppender change closeFile() to call writeFooter() and closeWriter() 
rather than this.qw.close()

In FileAppender change reset() not to call closeFile(), the call to super.reset
() will close the file by calling closeWriter() so there is no need to call 
closeFile() explicitly.

PS. I don't know of anyone ever using the footer functionality so this may not 
be top priority.

--
To unsubscribe, e-mail:   <mailto:log4j-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-dev-help@jakarta.apache.org>


Mime
View raw message