With the above configuration, the rolling was working fine for a single run of the application, but after a restart of the logging manager (or the application), the previous rolled files are overwritten instead of new rolled files being created with the last highest rolled file index.
- Create an application [console or wpf] with the above log4net config
- Start logging
- Until At least 10 rolled files are created
- Close and ReStart the application
- Start logging again
- Observe the rolled files
- Start logging and when the logging information reaches to maximumFileSize, the previous rolled file content will be overwritten with new content, instead of increasing the rolled file count.
Looked into the source code of RollingFileAppender found that
- At the initial phase all the rolled file names, are converted into the LowerInvariant and passing to the InitializeFromOneFile method
- Inside InitializeFromOneFile
- The date variable is not converting to lower or while comparing the curFileName with a prefix not using ignoreCase
- that is leading not to get last rolled file index
Is there any possibility to use ignoreCase while comparing curFileName with the prefix
Or is there any reason not to use ignoreCase while comparing curFileName with the prefix?