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:[EMAIL PROTECTED] Sent: Wednesday, May 07, 2008 5:35 AM To: [email protected] 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
