Rick Putnam
Rick Putnam

Reputation: 546

log4net -- log file is no longer being rolled over

We have log4net running with a couple of dozen services. Each service is configured to roll-over to a new log file every day. As of two weeks ago they were all working as expected and had been for several years (many several years in some cases). About 2 weeks ago, on one of the services, the log has stopped rolling over.

Things we've tried:

  1. verified no changes were made to the config
  2. restarted the service -- exe running under a windows service
  3. renamed the log file to force a new one to be created; new file is not rolling over

Here's the config:

<log4net>
    <appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net">
        <param name="File" value="logs\log.txt" />
        <param name="AppendToFile" value="true" />
        <param name="RollingStyle" value="Date" />
        <param name="DatePattern" value="yyyy.MM.dd" />
        <param name="StaticLogFileName" value="true" />
        <layout type="log4net.Layout.PatternLayout,log4net">
            <param name="ConversionPattern" value="%d %-5p %c (%L) - %m%n" />
        </layout>
    </appender>
    <appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
        <mapping>
            <level value="ERROR" />
            <backColor value="Red" />
        </mapping>
        <mapping>
            <level value="WARN" />
            <backColor value="Yellow" />
        </mapping>
        <mapping>
            <level value="INFO" />
            <backColor value="Green" />
        </mapping>
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
        </layout>
    </appender>
    <root>
        <priority value="ALL" />
        <appender-ref ref="rollingFile" />
        <appender-ref ref="ColoredConsoleAppender" />
    </root>
</log4net>

Any thoughts or guidance would be greatly appreciated.

Upvotes: 1

Views: 320

Answers (1)

Rick Putnam
Rick Putnam

Reputation: 546

And the answer is...

We deployed a monitoring job running under quartz.net scheduler that was kicking off every 15 minutes. I pushed the cycle time to start at 2 minutes after the hour instead of on the hour and the log recycled as expected last night.

Sometimes you just have to post the question in order to figure out the answer. Or, as in my case, until your build engineer makes the right conjecture.

Upvotes: 1

Related Questions