I am using Enterprise Library 4.1 Logging application block. Using a rolling flat file trace listener to save thelog file into the Application Root/Log directory. The listener is configured as:
You need to change rollFileExistsBehavior="Overwrite" to rollFileExistsBehavior="Increment" which will help you create a new file based upon your rollInterval you have set. Your most recent log file will always have "RMSLog.log" as the name, but your previous
log files will have date appended to it. In order to archive them in a separate a folder you can write a batch file and execute it on specified intervals using window task scheduler.
sudipta
Contributor
2274 Points
483 Posts
Enterprise Library 4.1 Logging Application Block Archive Log files.
Aug 10, 2009 10:46 AM|LINK
I am using Enterprise Library 4.1 Logging application block. Using a rolling flat file trace listener to save thelog file into the Application Root/Log directory. The listener is configured as:
<listeners> <add fileName="Log\RMSLog.log" footer="----------------------------------------" formatter="Text Formatter" header="----------------------------------------" rollFileExistsBehavior="Overwrite" rollInterval="Day" rollSizeKB="0" timeStampPattern="yyyy-MM-dd" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" traceOutputOptions="None" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Rolling Flat File Trace Listener" /> </listeners>Now, I want to save the archived files(archiving set to daily basis) into a different directory like "Archive". How to do that?
Irfaan
Member
52 Points
6 Posts
Re: Enterprise Library 4.1 Logging Application Block Archive Log files.
Aug 22, 2009 01:44 PM|LINK
Hi,
You need to change rollFileExistsBehavior="Overwrite" to rollFileExistsBehavior="Increment" which will help you create a new file based upon your rollInterval you have set. Your most recent log file will always have "RMSLog.log" as the name, but your previous log files will have date appended to it. In order to archive them in a separate a folder you can write a batch file and execute it on specified intervals using window task scheduler.
HTH,