New system to roll log file
Contrary to Log4Net (or to a lot of other logging mechanism like IIS logs), the rolling mechanism can cause some inconsistent dates problems.
Example with RollInterval.Midnight:
- The app is logging data on the rolling file on day n
- The app doesn’t write any data during x days
- The app is logging data on day n+x => the rollingHelper.RollIfNecessary() roll the file and put the current rolling date (n+x) as the name of the file, which is inconsistent with the content of the log file because of the check for the rolling is in the write method
In order to change the behavior, we have implemented two things in the RollingFileTraceListener:
- In the constructor, a timer has been setup in order to have a mechanism which creates the rolling file as soon as the RollInterval as expired (for example: at midnight for RollInterval.Midnight or in the first seconds of the minute for RollInterval.Minute).
- ComputeArchivefileName has been modified to substract one day or one minute (and so on) depending on the RooInterval, in order to be aligned with the data in the log file
Updated in v6. See http://aka.ms/el6