In my .NET application I use log4net with the following configuration:

<configuration>
    <configSections>
        <section name="log4net" 
           type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"
/>
    </configSections>
    <log4net>
<appender name="RollingLogFileAppender"
type="log4net.Appender.RollingFileAppender">
  <lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
  <file value="logs\" />
  <datePattern value="yyyy-MM-dd.lo\g"/>
  <staticLogFileName value="false" />
  <appendToFile value="true" />
  <countDirection value="1"/>   
  <rollingStyle value="Composite" />
  <maxSizeRollBackups value="10" />
  <maximumFileSize value="5MB" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date [%thread] %-5level %logger
[%property{NDC}] - %message%newline" />
  </layout>
</appender>

        <root>
            <level value="ALL" />
            <appender-ref ref="RollingLogFileAppender" />
        </root>
    </log4net>
</configuration>



It produces a set of log files like the following:
2012-09-24.log.0 
2012-09-24.log.1 
... 
2012-09-24.log.10

This is ALMOST what I want. The final thing I want is: to set a limit by
total size of ALL the log files in the given location (folder). In other
words - if total size of all the log files in the given location exceeds,
say, 100MB, the oldest file will be removed; does not matter does the file
belong to current day or to some day in the past. To the moment the .config
above provides a different logic: limit by size of all the log files in the
current GROUP (in my case the 'group' is 'current day').

Can I have RollingLogFileAppender working the way I want?

-- 
View this message in context: 
http://old.nabble.com/log4net-RollingLogFileAppender%3A-is-this-possible-to-set-limit-for-TOTAL-size-of-all-log-files--tp34471537p34471537.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Reply via email to