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 Pascal ROZE <pa...@gmail.com> on 2012/06/01 18:19:22 UTC

Log files overwritten

Hello everyone

I have a rolling file appender hosted in an IIS 6.0 application that looks
like:

<appender name="RollingFileError"
type="log4net.Appender.RollingFileAppender">
    <file value="C:\Logfiles\"/>
    <datePattern value="Error\s.yyyyMMdd.lo\g"/>
    <threshold value="ALL"/>
    <appendToFile value="true"/>
    <rollingStyle value="Composite"/>
    <maximumFileSize value="1MB"/>
    <maxSizeRollBackups value="-1" />
    <countDirection value="1" />
    <staticLogFileName value="false"/>
    <preserveLogFileNameExtension value="true"/>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="*%-10level %-30date %-25logger
%-15property{log4net:HostName} ThreadID: %-10thread %message %newline"/>
    </layout>
  </appender>

So, at the end of the day, I have some files like Errors.20120601.0.log,
Errors.20120601.1.log, Errors.20120601.2.log and so on.

But, if the application is restarted during the day, log file names restart
from 0 and the existing files are overwritten one after the other.

How to avoid that?

Thanx for your help

Pascal

Re: Log files overwritten

Posted by Pascal ROZE <pa...@gmail.com>.
Yes it does

Cheers
Pascal

On 3 June 2012 07:55, Lee Chun Kit <ch...@gmail.com> wrote:

> If you change your configuration
> from
> <datePattern value="Error\s.yyyyMMdd.lo\g"/>
> to
> <datePattern value="error\s.yyyyMMdd.lo\g"/>
> does the overwriting still happen?
>
> Regards,
> Chun Kit
>
>
> On Sat, Jun 2, 2012 at 12:19 AM, Pascal ROZE <pa...@gmail.com>
> wrote:
> > Hello everyone
> >
> > I have a rolling file appender hosted in an IIS 6.0 application that
> looks
> > like:
> >
> > <appender name="RollingFileError"
> > type="log4net.Appender.RollingFileAppender">
> >     <file value="C:\Logfiles\"/>
> >     <datePattern value="Error\s.yyyyMMdd.lo\g"/>
> >     <threshold value="ALL"/>
> >     <appendToFile value="true"/>
> >     <rollingStyle value="Composite"/>
> >     <maximumFileSize value="1MB"/>
> >     <maxSizeRollBackups value="-1" />
> >     <countDirection value="1" />
> >     <staticLogFileName value="false"/>
> >     <preserveLogFileNameExtension value="true"/>
> >     <layout type="log4net.Layout.PatternLayout">
> >       <conversionPattern value="*%-10level %-30date %-25logger
> > %-15property{log4net:HostName} ThreadID: %-10thread %message %newline"/>
> >     </layout>
> >   </appender>
> >
> > So, at the end of the day, I have some files like Errors.20120601.0.log,
> > Errors.20120601.1.log, Errors.20120601.2.log and so on.
> >
> > But, if the application is restarted during the day, log file names
> restart
> > from 0 and the existing files are overwritten one after the other.
> >
> > How to avoid that?
> >
> > Thanx for your help
> >
> > Pascal
> >
>

Re: Log files overwritten

Posted by Lee Chun Kit <ch...@gmail.com>.
If you change your configuration
from
<datePattern value="Error\s.yyyyMMdd.lo\g"/>
to
<datePattern value="error\s.yyyyMMdd.lo\g"/>
does the overwriting still happen?

Regards,
Chun Kit


On Sat, Jun 2, 2012 at 12:19 AM, Pascal ROZE <pa...@gmail.com> wrote:
> Hello everyone
>
> I have a rolling file appender hosted in an IIS 6.0 application that looks
> like:
>
> <appender name="RollingFileError"
> type="log4net.Appender.RollingFileAppender">
>     <file value="C:\Logfiles\"/>
>     <datePattern value="Error\s.yyyyMMdd.lo\g"/>
>     <threshold value="ALL"/>
>     <appendToFile value="true"/>
>     <rollingStyle value="Composite"/>
>     <maximumFileSize value="1MB"/>
>     <maxSizeRollBackups value="-1" />
>     <countDirection value="1" />
>     <staticLogFileName value="false"/>
>     <preserveLogFileNameExtension value="true"/>
>     <layout type="log4net.Layout.PatternLayout">
>       <conversionPattern value="*%-10level %-30date %-25logger
> %-15property{log4net:HostName} ThreadID: %-10thread %message %newline"/>
>     </layout>
>   </appender>
>
> So, at the end of the day, I have some files like Errors.20120601.0.log,
> Errors.20120601.1.log, Errors.20120601.2.log and so on.
>
> But, if the application is restarted during the day, log file names restart
> from 0 and the existing files are overwritten one after the other.
>
> How to avoid that?
>
> Thanx for your help
>
> Pascal
>

RE: Log files overwritten

Posted by Richard Pennenga <rp...@angel-med.com>.
I'm interested in the answer.  I use <rollingStyle value="Size"><maxSizeRollBackups value="2">; I lack the imbedded date, but it does the right thing on restart.  I recall starting with a setup like that below (<rollingStyle value="Composite">), and recall seeing this same behavior, and finally being told that it was a limitation of the implementation.  True?

rich

________________________________
From: Pascal ROZE [mailto:pascal.roze@gmail.com]
Sent: Friday, June 01, 2012 12:19 PM
To: Log4NET User
Subject: Log files overwritten

Hello everyone

I have a rolling file appender hosted in an IIS 6.0 application that looks like:

<appender name="RollingFileError" type="log4net.Appender.RollingFileAppender">
    <file value="C:\Logfiles\"/>
    <datePattern value="Error\s.yyyyMMdd.lo\g"/>
    <threshold value="ALL"/>
    <appendToFile value="true"/>
    <rollingStyle value="Composite"/>
    <maximumFileSize value="1MB"/>
    <maxSizeRollBackups value="-1" />
    <countDirection value="1" />
    <staticLogFileName value="false"/>
    <preserveLogFileNameExtension value="true"/>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="*%-10level %-30date %-25logger %-15property{log4net:HostName} ThreadID: %-10thread %message %newline"/>
    </layout>
  </appender>

So, at the end of the day, I have some files like Errors.20120601.0.log, Errors.20120601.1.log, Errors.20120601.2.log and so on.

But, if the application is restarted during the day, log file names restart from 0 and the existing files are overwritten one after the other.

How to avoid that?

Thanx for your help

Pascal