I have a rolling file appender configured with this:
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="appname" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<datePattern value="'.'yyyyMMdd'.log'" />
<maxSizeRollBackups value="30" />
<maximumFileSize value="10MB" />
<staticLogFileName value="false" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
This works fine, but I was wondering if there was a way to move the old log files into an "archive" folder, instead of having them moved to the same folder?
You can configure the log4net. config file to create log files. The file is located in the webroot\App_data directory of the installation. The different log files are described in Services logs.
RollingFileAppender can roll log files based on size or date or both depending on the setting of the RollingStyle property. When set to Size the log file will be rolled once its size exceeds the MaximumFileSize.
When using a file appender, the destination folder does not have to exist. Log4net creates the folder. Using an administrator account, connect to the Coveo Master server.
You can always open RollingLogFileAppender.cs and modify it to anything you want. It's open source, mate. And this class is really easy to extend. Personally I hate its naming style for log files, and I have my own RollingLogFileAppender to please me. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With