logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Collette <richard.colle...@tritanka.com>
Subject Re: configurable file purging and logging to two files
Date Thu, 03 Aug 2006 18:28:54 GMT
Try Using 
   
  <filter type="log4net.Filter.LoggerMatchFilter">
    <LoggerToMatch value="ACDPCD.CoreClass"/>
      <AcceptOnMatch value="false"/>
</filter>
   
  Within the main file appender.

  I haven't specifically used that before but from looking through the SDK it looks appropriate.
   
   
  

"Scribner, Aaron" <ascribner@necunified.com> wrote:
      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.



   

  Richard P. Collette
Certified Lotus Notes Principal Developer


Mime
View raw message