You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Klein, Scott @ TW" <sc...@L-3com.com> on 2003/01/31 17:21:17 UTC

RE: Help with Log4j automatic header generataion

I guess it depends on what the user really wants, but it seems that there
should be some checking (or an option) to alter the behavior of writing a
header to anything but a "fresh" file. I could see where you might want a
continous log regardless of shutdown, and also where you may want a header
to signal the restart of the log....

-----Original Message-----
From: David Sanders [mailto:dsanders@chaincast.com]
Sent: Thursday, January 30, 2003 6:02 PM
To: scott.klein@L-3com.com
Cc: Cory.McKinnon@xwave.com
Subject: RE: Help with Log4j automatic header generataion


http://www.mail-archive.com/log4j-user@jakarta.apache.org/msg05953.html


Thank you for the solution.  One problem, though:  If the logging 
process (JVM) is stopped and restarted, a 2nd header is written to the 
existing file.

Example:
- using DailyRollingFileAppender
- logged record #1.  Header was written first by MyPatternLayout.
- logged record #2
- Stopped process
- Started process
- logged record #3.  Header and record #3 were appended to existing file.

I don't want the header written if it's not a new file.  I'll see if 
PatternLayout can call theFile.length() and only write if length is 0.


David



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org