Not built into the RollingLogFileAppender.. There may be a hook if you want to extend it.. You'd want to make sure your cleanup wasn't done in the logging thread though, else it will hold up your application processing (and possibly your gui thread)
We have a separate method within our apps that remove log files older than XX days every time the app is started.. You could do something similar by having a timer fire every hour giving you a point to do your cleanup.. And you'd probably want to sort by modified date, getting rid of the oldest ones.. parsing the file names to determine the same would probably be annoying. I'm not going to ask why 20 x 100kb files per hour though.. we do one file per day ourselves.. -Peter On Wed, Jun 4, 2008 at 1:13 PM, Pranav Varia <[EMAIL PROTECTED]> wrote: > Currently I have RollingLogFileAppender configured to hold a max of 20 > files PER HOUR as follows: > <appender name="RollingLogFileAppender" > type="log4net.Appender.RollingFileAppender"> > <file value="c:\logs\MyService.log" /> > <appendToFile value="true" /> > <rollingStyle value="Composite" /> > <maxSizeRollBackups value="20" /> > <maximumFileSize value="100KB" /> > <datePattern value="yyyyMMdd-HH" /> > .... > </appender> > This configuration keeps last 20 files FOR EACH HOUR and hence the number > of files add up indefinitely over time. > Is there a way to configure a absolute max number of total files (without > regards to the rolling intervals)? I am looking to setup log4net to > basically keep a max of last X number of files at any given point in time in > the year or years. > Regards > Pranav > -- Peter's Photography www.PeterDrier.com
