DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43879>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43879

           Summary: FileAppender writes Header multiple times
           Product: Log4j
           Version: 1.3alpha
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Appender
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


FileAppender writes the Header again when an existing LogFile exists.
FileAppender should write the header only once per file (functionality not
documented). If so, the method writeHeader should check whether the file is
empty before writing a new header. If the file already contains data, no header
should be written. Otherwise you could end up having multiple headers in your
file (if you restart your JVM several times for instance).

A fix could look like this:

protected void writeHeader() {
        File logFile = new File(getFile());
        if (layout != null && this.qw != null && logFile.length() == 0) {
                this.qw.write("my Header\n");
        }
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to