I am creating a logger by using log4net's RollingFileAppender. One feature that I need to provide is to delete any logs that is over 14 days old.
How is that possible with using log4net's RollingFileAppender?
Thanks.
Try this
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value=".\Logs\" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<staticLogFileName value="false" />
<rollingStyle value="Date" />
<datePattern value="'On_'yyyy-MM-dd'.log'" />
<appendToFile value="true" />
<maxSizeRollBackups value="14" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %level %logger - %message%newline" />
</layout>
</appender>