why files not delete for maxDateRollBackups settings RRS feed

  • Question

  • User-883890505 posted

    I have below log4Net configuration,

    <appender name="WhateverYouNameThis" type="log4net.Appender.RollingFileAppender">
        <threshold value="All" />
        <file value="logs\WhateverYouNameThisFile.log" />
        <appendToFile value="true" />
        <maxDateRollBackups value="2" />
        <maxSizeRollBackups value="2" />
        <maximumFileSize value="2KB" />
        <rollingStyle value="Composite" />
        <staticLogFileName value="true" />
        <datePattern value="yyyyMMdd-HH.lo\g" />
        <layout type="log4net.Layout.PatternLayout">
            <param name="ConversionPattern" value="%d [%t] %-5p - %m%n" />

    "maxSizeRollBackups =2" works fine. When file gets larger than 2KB, it will roll to another file, up to 2 times, and then these will start getting deleted too if it goes over 2 files.

    but "maxDateRollBackups=2" is not working. Any files older than 2 days is not deleted. Please suggest the reason!

    When date change the file rename with 1 day before date, but files older than 2 days is not delete,

    enter image description here


    Wednesday, January 11, 2017 3:56 PM

All replies

  • User-707554951 posted

    Hi  ajmaly,

    As far as I know, v1.2.10 doesn't support deleting older log files based on rolling by date. It is on the task list for the next release. I took the source code and added the functionality myself, and posted it for others if they are interested. The issue and the patch can be found at :


    Best Regard


    Thursday, January 12, 2017 8:29 AM