logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Schmidt" <bin...@gmail.com>
Subject Re: Using log4net.Util.PatternString in a PatternLayout
Date Wed, 07 May 2008 15:10:14 GMT
I had noticed it too.  My assumption as to the creation time stamp is
that when log4net rolls the files, It copies the current log file to
another file, and clears out the buffer of the current log, since the
log that it has is currently open,  this is easier(less prone to
errors) and faster than closing the log, deleting it, then recreating


On Wed, May 7, 2008 at 11:03 AM, Eric Chamberlain
<echamberlain@ventripoint.com> wrote:
> I have just recently had the task of archiving off some log4net-generated
>  files created by a rolling file appender and have found that they all have
>  the same creation date.   This appears to be a result of the method used to
>  roll the files.  Perhaps it's a feature?   In any case, it surprised me.
>  Fortunately, I could use the last-written timestamp for my purposes.
>  However, it would be nice to hear if anyone knows if there is a functional
>  reason why all rolling file appender logs have the creation date of the
>  first log file....
>  Eric Chamberlain
>  Software Engineer, VentriPoint, Inc.
>  -----Original Message-----
>  From: Roy Chastain [mailto:Roy@roychastain.org]
>  Sent: Wednesday, May 07, 2008 5:35 AM
>  To: log4net-user@logging.apache.org
>  Subject: Using log4net.Util.PatternString in a PatternLayout
>  I have the following layout defined for a RollingFileAppender  (log4Net
>  1.2.10)
>  <layout type="log4net.Layout.PatternLayout">
>   <param name="Header" type="log4net.Util.PatternString"
>  value="%newline**** Trace Opened     Local: %date{yyyy-MM-dd
>  HH:mm:ss.fff}     UTC: %utcdate{yyyy-MM-dd HH:mm:ss.fff} ****%newline"
>  />
>   <param name="Footer" type="log4net.Util.PatternString" value="****
>  Trace Closed %date{yyyy-MM-dd HH:mm:ss.fff} ****%newline" />
>   <param name="ConversionPattern" value="%d{dd HH:mm:ss.fff} [%4t]
>  %P{instance}::%M - %m%n" />
>  </layout>
>  The idea is to place the current date and time in the header and footer
>  of each log file as it rolls over.  Instead each header and footer
>  receives the same date/time.  (The date/time is the date/time the
>  original file was opened.)
>  This action is certainly not what was expected, and I do not believe a
>  useful implementation.
>  Can someone say that the result is has expected and, if so, please give
>  some pointers on how to implement a 'current date/time' for the headers
>  and footers?
>  Thanks
>  ------------------------------------------------------------------------
>  ----------
>  Roy Chastain

View raw message