On 2014-08-14, Mohkam Singh Sawhney wrote: > I am using log4Net v1.2.13 in a .NET 4 C# project. I have setup a > RollingFileAppender to roll on size. My aim is to keep appending to a > log file and roll on size. I need to maintain all the previous log > files. But I found that every time my application restarts all the log > files after the 2nd log file that was generated in the previous run > get overwritten.
To be honest, RollingFileAppender is the source of most of our bug reports and I don't think anybody of the current team feels comfortable touching it. It's more than about time to rewrite it. You are providing excellent information that will help us reproducing the issue, it would be a shame to lose that, so please open a new JIRA issue with it. > A similar scenario described in this issue tracker - LOG4NET-378. The > bug has been closed with resolution fixed in v1.2.12. Looking at the patch that resolved it[1] the patch only applies to the case where you are rolling on date boundaries (and maybe on size as well), a sibbling of the issue may be lurking in the branch that apploes to "pure" rolling on size. > I would appreciate it if somebody could confirm the following points > 1. What is the default value of maxSizeRollBackups if it is not > mentioned in the config file. I could not find this in documentation > for this property. The default value is 0, I'll look into updating the docs. > 2. For the scenario that I described is expected to include > maxSizeRollBackups=-1 in the config file? At least to a value != 0. 0 means not to keep any backups and I think what you expierence is an off by one error and the code was supposed to overwrite the first log file first rather than the second. Stefan