You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by Michel Émond <me...@innobec.com> on 2015/05/12 21:01:53 UTC

Rolling log file is overwritten when application is restarted

Hello,

This is the first time I contribute to an open source project, your 
assistance will be much appreciated.
I read your FAQ and I believe I'm doing things in the right manner. 
Please let me know otherwise.

While using version 1.2.13, I'm experiencing the issue described in this 
bug:
https://issues.apache.org/jira/browse/LOG4NET-378

In a nutshell: My app is running, rolling style is set to Composite, log 
files are piling up in the folder, all is good. Then I reset IIS, and 
restart my app. I would expect the rolling to continue on or after the 
last file. But instead, the rolling restarts at index 1 and overwrites 
the existing files.

The original bug fix addresses the issue in the 
*InitializeFromOneFile*() method.
However, the *GetWildcardPatternForFile*() method also needs the 
baseFileName to be adjusted with the datePattern so the proper files are 
searched.
I placed a file path fix in the *DetermineCurSizeRollBackups*() method, 
so it's then passed down to the two other methods and everyone gets happy.

Here's a calling stack sample:
*DetermineCurSizeRollBackups*()
|
+--GetExistingFiles()
|  +--*GetWildcardPatternForFile*()
|
+--InitializeRollBackups()
    +--*InitializeFromOneFile*()


You'll find attached to this email:
- the part of my web.config file that relates to log4net
- a patch containing my fix

Please let me know how good this fix is, and if it fits your quality 
standards.
Once we're settled, I could work on the unit tests, or let you deal with 
it at your convenience.

Thanks!

-- 

*Michel Émond*
Programmer Analyst

Innobec <http://www.innobec.com>

*T*  1-514-272-0979 *#240*
*T* 1-800-972-0979 *#240*
www.innobec.com <http://www.innobec.com>