You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Dominik Psenner (JIRA)" <ji...@apache.org> on 2013/06/05 16:30:20 UTC
[jira] [Resolved] (LOG4NET-355) Issue: The log files truncated to
size zero at mid night when new file is being generated for new day
[ https://issues.apache.org/jira/browse/LOG4NET-355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dominik Psenner resolved LOG4NET-355.
-------------------------------------
Resolution: Won't Fix
Fix Version/s: 1.2.12
Assignee: Dominik Psenner
You have log4net configured badly. Multiple processes are logging to the same file and minimallock doesn't work in that case. This site may be of interest to you:
http://hectorcorrea.com/blog/log4net-thread-safe-but-not-process-safe
> 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
> Assignee: Dominik Psenner
> Priority: Critical
> Fix For: 1.2.12
>
>
> 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