[prev in list] [next in list] [prev in thread] [next in thread] 

List:       log4net-dev
Subject:    Re: Rolling files on date/time boundaries doesn't support a maximum
From:       Michael Schall <mike.schall () gmail ! com>
Date:       2010-07-01 14:27:43
Message-ID: AANLkTinTj6HIfohlGfElbxznp8Gyi5QRdqegcmbNFoer () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I found a few issues with my implementation so I'm sending out the updated
file.  The RollingFileAppender will now check on startup of there are files
that need to be deleted and I have fixed how I was finding the delete date.

On Thu, Jun 17, 2010 at 3:08 PM, Michael Schall <mike.schall@gmail.com>wrote:

> This is a feature that many have asked for and a few have submitted patches
> for.  I downloaded the latest patch and it seems to have issues with several
> new features in trunk.
> https://issues.apache.org/jira/browse/LOG4NET-27
>
> I have attached an implementation that seems to be working how I think it
> should, but thought I would ask on this list to see what people thought.
>
> The main question I have is, should the files removed because of the
> "MaxDateRollBackups" property be completely date based?
>
> All logs that follow assume you are rolling over on 2010-06-18 with a date
> pattern of .yyyy-MM-dd.
>
> Lets say i have the following logs and I set my MaxDateRollBackups to 4
> foo.2010-06-17.log
> foo.2010-06-16.log
> foo.2010-06-15.log
> foo.2010-06-15.1.log
> foo.2010-06-15.2.log
> foo.2010-06-14.log
> foo.2010-06-13.log
> foo.2010-06-12.log
> foo.2010-06-11.log
>
> Should I keep:
> foo.2010-06-17.log
> foo.2010-06-16.log
> foo.2010-06-15.log
> foo.2010-06-15.1.log
> foo.2010-06-15.2.log
> foo.2010-06-14.log
>
> Or keep:
> foo.2010-06-17.log
> foo.2010-06-16.log
> foo.2010-06-15.log
> foo.2010-06-15.1.log
>
> My current implementation keeps the former.  I followed the
> MaxSizeRollBackups idea of not caring about Date (It only removes the one
> for the current period) so I don't care about size rolls.  It also makes it
> easer as I don't have to work about count direction and other properties.
>  If the date parsed is older than MaxSizeRollBackups RollPoint (setup by
> date pattern) it is removed.
>
> This is really how I would like to see it anyway because if I have a busy
> logging day and it rolls several times by size, I don't want to lose
> yesterdays logs.
>
> The possible down side this way is if you have the following logs, with
> a MaxDateRollBackups to 4.  I'm fine with this, but thought I would see what
> others thought.
>
> foo.2010-06-17.log
> foo.2010-06-16.log
> foo.2010-06-12.log
> foo.2010-06-11.log
>
> The last two would be removed.
>
> Thoughts?
> Thanks for any feedback.  This has not been tested well, but seems to work
> how I have it configured.  I'm also not positive it works with < .Net 2.0  I
> checked docs and tried not to use anything not supported.
>
> Mike
>

[Attachment #5 (text/html)]

I found a few issues with my implementation so I&#39;m sending out the updated file.  \
The RollingFileAppender will now check on startup of there are files that need to be \
deleted and I have fixed how I was finding the delete date.<br> <br><div \
class="gmail_quote">On Thu, Jun 17, 2010 at 3:08 PM, Michael Schall <span \
dir="ltr">&lt;<a href="mailto:mike.schall@gmail.com">mike.schall@gmail.com</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex;"> <div>This is a feature that many have asked for and a \
few have submitted patches for.  I downloaded the latest patch and it seems to have \
issues with several new features in trunk.</div><a \
href="https://issues.apache.org/jira/browse/LOG4NET-27" \
target="_blank">https://issues.apache.org/jira/browse/LOG4NET-27</a><div>

<br></div><div>I have attached an implementation that seems to be working how I think \
it should, but thought I would ask on this list to see what people \
thought.</div><div><br></div><div>The main question I have is, should the files \
removed because of the &quot;MaxDateRollBackups&quot; property be completely date \
based?</div>

<div><br></div><div>All logs that follow assume you are rolling over on 2010-06-18 \
with a date pattern of .yyyy-MM-dd.</div><div><br></div><div>Lets say i have the \
following logs and I set my MaxDateRollBackups to 4</div>

<div>foo.2010-06-17.log</div><div>foo.2010-06-16.log</div><div>foo.2010-06-15.log</div \
><div>foo.2010-06-15.1.log</div><div>foo.2010-06-15.2.log</div><div>foo.2010-06-14.log</div><div>foo.2010-06-13.log</div><div>foo.2010-06-12.log</div>
> 

<div>foo.2010-06-11.log</div><div><br></div><div>Should I \
keep:</div><div>foo.2010-06-17.log</div><div><div>foo.2010-06-16.log</div><div>foo.2010-06-15.log</div><div>foo.2010-06-15.1.log</div><div>foo.2010-06-15.2.log</div>


<div>foo.2010-06-14.log</div></div><div><br></div><div>Or keep: \
</div><div><div>foo.2010-06-17.log</div><div><div>foo.2010-06-16.log</div><div>foo.2010-06-15.log</div><div>foo.2010-06-15.1.log</div></div></div><div><br></div>


<div>My current implementation keeps the former.  I followed the MaxSizeRollBackups \
idea of not caring about Date (It only removes the one for the current period) so I \
don&#39;t care about size rolls.  It also makes it easer as I don&#39;t have to work \
about count direction and other properties.  If the date parsed is older than \
MaxSizeRollBackups RollPoint (setup by date pattern) it is removed.</div>

<div><br></div><div>This is really how I would like to see it anyway because if I \
have a busy logging day and it rolls several times by size, I don&#39;t want to lose \
yesterdays logs.  </div><div><br></div><div>The possible down side this way is if you \
have the following logs, with a MaxDateRollBackups to 4.  I&#39;m fine with this, but \
thought I would see what others thought.</div>

<div><br></div><div><div>foo.2010-06-17.log</div><div>foo.2010-06-16.log</div><div>foo.2010-06-12.log</div><div>foo.2010-06-11.log</div></div><div><br></div><div>The \
last two would be removed.</div><div><br></div><div>Thoughts?</div>

<div>Thanks for any feedback.  This has not been tested well, but seems to work how I \
have it configured.  I&#39;m also not positive it works with &lt; .Net 2.0  I checked \
docs and tried not to use anything not supported.</div>

<div><br></div><div>Mike</div>
</blockquote></div><br>

--0016364ecce81f1428048a5446ee--


["RollingFileAppender.cs" (application/octet-stream)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic