You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Yash Ganthe <ya...@gmail.com> on 2010/11/04 20:12:33 UTC

Rolling files at a given time


Hi,

Our requirement is to be able to roll the log files every night at 9 pm  
and not at the day boundary. Is it possible to do so using  
RollingFileAppender?

Thanks,
Yash
-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/

Too many rolling files

Posted by Rob Richardson <Ro...@rad-con.com>.
Greetings!

I have a log using a rolling file appender that is configured to save
100 files.  (Or at least I think it is.)  There are currently 109 files
in the folder.  Why?

My configuration file is below.

RobR

<?xml version="1.0" encoding="utf-8"?>
<log4net>
  <appender name="RollingFile"
type="log4net.Appender.RollingFileAppender">
    <file value="TrendMasterCS.log" />
    <appendToFile value="true" />
    <maximumFileSize value="20MB" />
    <maxSizeRollBackups value="100" />

    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date - %message%newline" />
    </layout>
  </appender>

  <appender name="EventLogger" type="log4net.Appender.EventLogAppender">
    <ApplicationName value ="TrendMasterCS" />
    <threshold value="INFO" />
    <mapping>
      <level value="ERROR" />
      <eventLogEntryType value="Error" />
    </mapping>
    <mapping>
      <level value="INFO" />
      <eventLogEntryType value="Information" />
    </mapping>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date - %message%newline" />
    </layout>
  </appender>

	<root>
		<level value="DEBUG" />
    <appender-ref ref="RollingFile" />
    <appender-ref ref ="EventLogger" />
  </root>
	  
	<logger name="TrendMasterCS.TagDatabase">
<!--    
		<level value="DEBUG" />
    <appender-ref ref="RollingFile" />
-->    
  </logger>

  <logger name="TrendMasterCS.TagReader">
<!--    
    <level value="DEBUG" />
    <appender-ref ref="RollingFile" />
-->    
  </logger>


</log4net>

Re: Rolling files at a given time

Posted by Brian <br...@gmail.com>.
Yash Ganthe <yashgt <at> gmail.com> writes:

> 
> 
> Hi,
> 
> Our requirement is to be able to roll the log files every night at 9 pm  
> and not at the day boundary. Is it possible to do so using  
> RollingFileAppender?
> 
> Thanks,
> Yash


Is there a sample log4net design document out there anywhere?  Not a des doc 
showing  how log4net works but one that shows how it is used in a project.  I 
have been tasked to write one and was just hoping to find one already made 
that I can use.