> -----Original Message----- > From: Ceki G�lc� [mailto:[EMAIL PROTECTED] > Sent: 09 June 2004 10:14 > To: Log4NET User > Subject: RE: XML Layout > > > At 12:40 AM 6/9/2004, Nicko Cadell wrote: > >Another solution is to ignore the main issue. > > :-) > > >If you can setup a rolling strategy that rolls the file on > startup if > >it exists then you have a situation where you never need > append to the file. > > Good point. In my analysis outlined in my previous message, > this case was mentally merged into a "rollover", but you are > right it is a slightly different case.
Actually it could be possible to tie this behaviour to the append flag inherited from FileAppender. Currently when using the RollingFileAppender it would seem to be wrong not to set append to true. If it is set to false then the RollingFileAppender must always roll any existing file out of the way before creating the new file.
Funny you should mention it. In one of the last changes to o.a.l.rolling.RollingAppender (the strategy-based rolling appender), if an error occurs during the rollover process, we append to the existing file. If the rollover succeeds the new log file is sure to be empty, so setting the "append" property to true or false has no effect. Setting the append property always to true will work in case of failed rollover as well as successful rollover. The decision was made to explicitly set the "append" property with the hope of making the code clearer. It's mostly hair-splitting actually.
Coming back to your proposal, during rollover, whether we append to the log file or not depends on whether the rollover was successful or not.
Maybe the whole thing is tractable. However, any complete solution needs to take into a large number of combinations which will invariably result in software hard to understand and to maintain.
Currently, I choose to just ignore the multiple header/footer issue.
Nicko
-- Ceki G�lc�
For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp
