It is possible.  Example below

                <appender name="RollingTrace" 
type="log4net.Appender.RollingFileAppender">
                        <param name="File" 
value="${ALLUSERSPROFILE}\\Trace.txt" />
                        <param name="AppendToFile" value="true" />
                        <param name="MaxSizeRollBackups" value="4" />
                        <param name="MaximumFileSize" value="500000" />
                        <param name="RollingStyle" value="Size" />
                        <param name="StaticLogFileName" value="true" />
                        <param name="Threshold" value="TRACE" />
                        <param name="PreserveLogFileNameExtension" value="true" 
/>
                        <layout type="log4net.Layout.DynamicPatternLayout">
                                <param name="Header" 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" 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>
                </appender>

Just FYI, this will not work out of the box.  The Header/Footer formatting will 
work, but the time will not ever change with the release code.  I had to update 
some of the DynamicPatternLayout code to make it re-evaluate the date/time for 
each file.

I am willing to share the changes, but I have NO IDEA how to use the source 
control product to create the changes etc.




From: Wilco K [mailto:[email protected]] 
Sent: Thursday, October 08, 2009 09:13
To: [email protected]
Subject: Header in new file

LS,

Is it possible to log a header message to a new file (using 
the rollingfileappender)? (not a header before every log entry)
 
Grz 
________________________________________
Deel je favoriete foto's online met Windows Live Photos

Reply via email to