logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scribner, Aaron" <ascrib...@necunified.com>
Subject configurable file purging and logging to two files
Date Thu, 03 Aug 2006 13:27:24 GMT
1) Is there a configuration option for having files, say older than 14
days, purged from the hard drive?
 
2) I am logging particular events to a separate file and have that
working. The problem arises from the fact that these events are logged
both to my main log file and also to the separate file. What in my
configuration needs some tweaking?
 
 <log4net>
  <appender name="WndAppender" type="CustomAppenderes.InternalAppender,
InternalAppender">
   <layout type="log4net.Layout.PatternLayout">
    <param name="ConversionPattern" value="%d{HH:mm:ss}
[%t]\t%-5p\t%c{3} [%x] - %m"/>
                 
   </layout>
  </appender>
  <appender name="TraceAppender" type="log4net.Appender.TraceAppender" >
   <layout type="log4net.Layout.PatternLayout">
    <param name="ConversionPattern" value="%d [%t] %-5p %c [%x] - %m%n"
/>
   </layout>
  </appender>
  
  <appender name="LogFileAppender"
type="log4net.Appender.RollingFileAppender">
   <param name="File" value="./Logs/log-file.txt" />
   <param name="AppendToFile" value="true" />
   <param name="MaxSizeRollBackups" value="20" />
   <param name="MaximumFileSize" value="100MB" />
   <param name="StaticLogFileName" value="true" />
   <layout type="log4net.Layout.PatternLayout">
    <param name="Header" value="[ Logging start ... ]\r\n" />
    <param name="Footer" value="[ Logging end ... ]\r\n" />
    <param name="ConversionPattern" value="%d [%t] %-5p %c [%x]
&lt;%X{auth}&gt; - %m %n " />
   </layout>
  </appender>
 
  <appender name="MsgsAppender"
type="log4net.Appender.RollingFileAppender" >
   <param name="File" value="./Logs/Msgs.log" />
   <param name="AppendToFile" value="true" />
   <param name="MaxSizeRollBackups" value="20" />
   <param name="MaximumFileSize" value="100MB" />
   <param name="StaticLogFileName" value="true" />
   <layout type="log4net.Layout.PatternLayout">
    <param name="ConversionPattern" value="%d{HH:mm:ss,fff} %m %n" />
   </layout>
  </appender>
   
  <!-- Setup the root category, add the appenders and set the default
level -->
  <root>
   <level value="ERROR" />
   <appender-ref ref="LogFileAppender" />
   <appender-ref ref="WndAppender" />
   <appender-ref ref="TraceAppender" />   
  </root>
  <logger name="ACDPCD.CoreClass">
    <level value="ALL" />
    <appender-ref ref= "MsgsAppender" />
  </logger>
 </log4net>
 
Aaron Scribner
Software Engineer
NEC Unified Solutions, Inc.

Mime
View raw message