You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Michel Émond <me...@innobec.com> on 2015/06/08 15:43:06 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 short, 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>
Re: Rolling log file is overwritten when application is restarted
Posted by Stefan Bodewig <bo...@apache.org>.
Hello Michel
I'm sorry I overlooked the message when you sent it.
On 2015-06-08, Michel Émond wrote:
> This is the first time I contribute to an open source project, your
> assistance will be much appreciated.
I wouldn't have expected a patch on the use mailing list, but that may
be just me. If LOG4NET-378's fix is incomplete, it would be good to
open a new one (and link the two issues) and attach your patch there.
> In short, 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.
Even without having studied you patch, this sounds like a good
approach. I'm not sure how soon I'll find time to look into this.
> Once we're settled, I could work on the unit tests, or let you deal
> with it at your convenience.
If you can come up with a unit test, this would be great - even if in
the end we'd elect to take a different approach to fixing the problem.
Cheers
Stefan