A service I have is suddenly spewing tons of log files and is not limiting the number of files written. The logs are (sort of) named MyService.2015-01-08.1, MyService.2015-01-08.2, MyService.2015-01-08.3, etc, all the way until 218 currently. I'd like to limit this to 10 per day instead of it being unlimited like right now. Here is what the log config was previously:
<appender name="RollingFileAppender" type="Ourlib.Logging.CustomRollingFileAppender">
<file value="c:\logs\myservice" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<staticLogFileName value="false" />
<maxSizeRollBackups value="-1" />
<countDirection value="1" />
<maximumFileSize value="5000KB" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%utcdate [%thread] %-5level %property{CorrelationId} %property{CallPath} %logger{2} - %message%newline" />
</layout>
</appender>
I've made some changes, seen below. Notably, I've set maxSizeRollBackups
to 10, which I thought would fix the problem, but doesn't seem to have made a difference.
<appender name="RollingFileAppender" type="Ourlib.Logging.CustomRollingFileAppender">
<file value="c:\logs\myservice" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<staticLogFileName value="false" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="5000KB" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%utcdate [%thread] %-5level %property{CorrelationId} %property{CallPath} %logger{2} - %message%newline" />
</layout>
</appender>
The change has been deployed but it's still creating new log files, way past the newly set 10.
Assuming that my deploy was done correctly, what could be wrong? Am I misunderstanding the config properties I changed, or is there something else going on here?
Thanks all!
<countDirection value="1" />
? – Lanford