Rolling comments inside a log4net file
        Posted  
        
            by Maestro1024
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Maestro1024
        
        
        
        Published on 2010-03-26T19:42:35Z
        Indexed on 
            2010/03/26
            19:43 UTC
        
        
        Read the original article
        Hit count: 569
        
logging
|log4netconfiguration
Rolling comments inside a log4net file
Is it possible to roll the data inside the log file?
So I have an xml config file like
<log4net>
  <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
    <layout type="log4net.Layout.PatternLayout">
      <ConversionPattern value="%d{yyyy-MM-dd hh:mm:ss} – %-5p: %m%n" />
    </layout>
    <param name="File" value="c:\log.txt" />
    <param name="AppendToFile" value="true" /> 
    <rollingStyle value="Size" />
    <maxSizeRollBackups value="1" />
    <maximumFileSize value="5MB" />
    <staticLogFileName value="false" />
  </appender>
  <root>
    <level value="DEBUG" />
    <appender-ref ref="LogFileAppender" />
  </root>
</log4net>
What I want is to have a 5MB file that when it gets to the end will pull off the first line of the file and then add a new line at the end. Is that possible (I do not see it in the documentation)?
© Stack Overflow or respective owner