When using the RollingFileAppender, Sitecore log files might stop being updated. The issue can occur in the following scenarios:
The root cause of the issue is that, in the course of recycle overlapping, the old worker process holds an exclusive lock on the log files preventing the new worker process from updating those log files.
To resolve the issue, consider one of the following options:
Alternatively, you can patch the LogFileAppender by creating a configuration patch file in the \App_Config\Include\zzz folder:
<?xml version="1.0" encoding="utf-8" ?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<log4net> <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender, Sitecore.Logging" patch:instead="*[@name='LogFileAppender']"> <file value="/App_Data/logs2/log.{date}.{time}.txt"/> <appendToFile value="false" /> <countDirection value="1" /> <rollingStyle value="Size"/> <maxSizeRollBackups value="-1"/> <maximumFileSize value="10MB"/> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n"/> </layout> <encoding value="utf-8"/> </appender> </log4net> </sitecore> </configuration>
This patch file example sets the value of the appendToFile property to "false" and the value of the countDirection property to "1". In this way, a new log file with a sequential number at the end will be created upon recycling the Application Pool or restarting the IIS Server.