Generating log files in a daily basis using RollingFlatFileTraceListener

Topics: Logging Application Block
Mar 13, 2008 at 5:28 AM
Hi all,

I have implemented code like following.

<add fileName="trace.log" rollSizeKB="0" timeStampPattern="yyyy-MM-dd" rollFileExistsBehavior="Overwrite" rollInterval="Day" header="----------------------------------------" footer="----------------------------------------" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" name="Rolling Flat File Trace Listener"/>

If i changed the system date manually then its working fine, a new file is created with the current date.

But the cases like

if i starts the application on 12th March 2008 11:59:00 PM , And working till 13th March 00:05:02 AM. Its not creating any new log file with the current date.Its continuously logging to "trace.log" which was created on 12th March 2008.

Please help me how to resolve this..

Thanks in Advance,

veeruu
Mar 25, 2008 at 8:06 PM
You need to change your rollFileExistsBehavior to "Increment"