Acetrax created LOG4NET-355: ------------------------------- Summary: Issue: The log files truncated to size zero at mid night when new file is being generated for new day Key: LOG4NET-355 URL: https://issues.apache.org/jira/browse/LOG4NET-355 Project: Log4net Issue Type: Bug Components: Other Environment: ASP.NET 4.0 , IIS 7 , windows 2008 R2 Reporter: Acetrax Priority: Critical
Hi, We are facing an issue with our daily logs, we have implemented log4net logging in our ASP.NET application. At mid night when the new file is going to be generated and the old file is getting renamed, the process somehow locks the files and the size of the old file which was going to be renamed is truncated to size zero. Our environment is IIS7.0 Windows server 2008R2, ASP.NET 4.0 and we have created multiple domains on IIS pointing to the same website and generating their separate logs based on the settings in web config. Also we have enabled internal log4net logging and it gave us the error : log4net:ERROR [RollingFileAppender] Unable to acquire lock on file D:\Project\Frontends\Logs\ UK\WebShoplog.txt. The process cannot access the file 'D:\Project\Frontends\Logs\ UK\WebShoplog.txt' because it is being used by another process. I would appreciate any help on this. Regards, AcetraxSupport The Setting we are using in Web config is: <appender name="ARollingFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="D:\Project\Frontends\Logs\log.txt" /> <appendToFile value="true" /> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> <rollingStyle value="Date" /> <datePattern value="yyyyMMdd" /> <maxSizeRollBackups value="10" /> <maximumFileSize value="10MB" /> <staticLogFileName value="true" /> <filter type="log4net.Filter.LevelRangeFilter"> <levelMin value="INFO" /> <levelMax value="FATAL" /> </filter> <filter type="log4net.Filter.DenyAllFilter" /> <!--<threshold value="ALL" />--> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%d{yyyy-MM-dd HH:mm:ss} %-5level - %property{IpAddress} %property{Username} - %message%newline" /> </layout> </appender> <appender name=" ASmtpAppender " type="DLL name"> <to value="To.com" /> <from value="abc.com" /> <subject value="WebShops" /> <smtpHost value="localhost" /> <bufferSize value="1" /> <lossy value="false" /> <threshold value="FATAL" /> <layout type="DLL Name" /> </appender> <logger name="domain1.com"> <appender-ref ref="ARollingFileAppender" /> <!--<appender-ref ref="ASmtpAppender" />--> </logger> -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira