Saturday, February 04, 2012
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.

Subject: Prevent Logging Headers/Footers
Prev Next
You are not authorized to post a reply.

Author Messages
Brian Beaudet

02/17/2004 11:08 PM  

I’m using a RollingFileAppender and when I set the root’s level-value to “OFF”, I’d like the header and footer not to be appended to my log file.  How do I do that?  Currently, the header/footer gets appended to my log each time by application starts and stops.  Here’s my configuration code:

 

<log4net>

  

  <root>

    <level value="NONE"/>

    <appender-ref ref="RollingLogFileAppender" />

  </root>

  

  <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">

            <param name="File" value="TPEMigrationTool.log" />

            <param name="AppendToFile" value="true" />

            <param name="MaxSizeRollBackups" value="10" />

            <param name="MaximumFileSize" value="100KB" />

            <param name="RollingStyle" value="Size" />

            <param name="StaticLogFileName" value="true" />

            <layout type="log4net.Layout.PatternLayout">

                  <param name="Header" value="********************[Header]********************\r\n" />

                  <param name="Footer" value="********************[Footer]********************\r\n" />

                  <param name="ConversionPattern" value="%d [%t] %-5p %c{2} [%x] - %m%n" />

            </layout>

      </appender>

  

</log4net>

 

Nicko Cadell

02/21/2004 11:52 PM  

Brian,

The header / footer functionality of the FileAppender is triggered by the
opening and closing of the file. Therefore the header and footer are written
to the file even if no events are logged.

If you set the logging level to OFF you may as well also comment out the
<appender-ref ref="RollingLogFileAppender" /> line. If the appender is not
referenced it will not be loaded, therefore the file will not be opened, the
header won't be written etc...

If you need to reference the appender because you want to programmatically
change the logging level then you will need to modify the FileAppender and
RollingFileAppender to only log the header when the first event arrives.

Nicko

You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > Prevent Logging Headers/Footers



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement