Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get log4net to keep only the last X days of logs?

I only want log4net to keep let's say 10 days-worth of log files as keeping them growing indefinitely will eventually eat up my disk space. I had thought that I could do this by setting

<maxSizeRollBackups value="10" />

on my RollingFileAppender but no dice. How do I do this?

like image 739
George Mauer Avatar asked Jul 13 '09 20:07

George Mauer


1 Answers

Take a look at this similar post for answers.

Make sure you are not rolling the logs by Date as per the SDK:

A maximum number of backup files when rolling on date/time boundaries is not supported.

like image 165
Sanjay Sheth Avatar answered Nov 03 '22 01:11

Sanjay Sheth