logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Chamberlain" <echamberl...@ventripoint.com>
Subject RE: Using log4net.Util.PatternString in a PatternLayout
Date Wed, 07 May 2008 15:03:55 GMT
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

<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" />

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?


Roy Chastain

View raw message