Re: problem with rolling by date behavior of RollingFileAppender

"Shayne Studdard" <[email protected]> Tue, 21 Dec 2004 13:30:37 -0600
Newsgroups gmane.comp.windows.dotnet.log4net.user
Message-ID <[email protected]>
Robert, I didn't see anyone respond to your problem, but I experienced the 
same thing this week and have fixed it since I couldn't find any previous 
responses to it.

I'd submit the fix to dev, but I really don't see much activity there.

Your workaround is fine, but if you want to fix the code there are two 
options.

1.  Change the following line in Appender\RollingFileAppender.cs in the 
method ComputeCheckPeriod from:

DateTime epoch = DateTime.Parse("1970-01-01 00:00:00Z", 
System.Globalization.DateTimeFormatInfo.InvariantInfo);

to:

DateTime epoch = DateTime.Parse("1970-01-01 00:00:00");

2.  Or you can change the two references following the above declaration to 
epoch to be "epoch.ToUniversalTime()".

The problem is when the date is instantiated/parsed, it adjusts the 
universal time by your current time zone.  This causes the rolling file 
appender to think your roll point is half days, when in fact it is fully 
days.




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/