Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi
How can i create a new log file everyday through enterprise library.
When i was surfing the net, I found rollinterval option to be specified which will allow you to create the file based on the value(interval of time) specified .
But I want to know how is it implemented.
Let me know if any other options are available
Posted

1 solution

Check below configuration. You need to set
rollFileEsistBehaviour="Increment"
rollInterval="Day"
rollSizeKB="Maximum size of file after which new file will be created"
timeStampPattern="dd-MM-yyyy" - file name pattern

XML
<loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General">
        <listeners>
            <add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" footer="-[END]---------------------------------------" formatter="Text Formatter" header="-[START]---------------------------------------" rollFileExistsBehavior="Increment" rollInterval="Day" rollSizeKB="1000" timeStampPattern="dd-MM-yyyy" fileName="c:\Logs\Applicationlogs.log" />
        </listeners>
</loggingConfiguration>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900