[ 
https://issues.apache.org/jira/browse/LOG4NET-485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15261896#comment-15261896
 ] 

Christoph Herzog commented on LOG4NET-485:
------------------------------------------

Tested with 1.2.15, definitly not fixed.

The whole part which is reponsible for rolling/creating of files needs to be 
garded by locks!

Worst case, when logging from multiple processes, is that the call to Log is 
stuck
{quote}
        mscorlib.dll!System.Threading.WaitHandle.WaitOne()      Unknown
        
log4net.dll!log4net.Appender.RollingFileAppender.AdjustFileBeforeAppend()       
Unknown
        
log4net.dll!log4net.Appender.RollingFileAppender.Append(log4net.Core.LoggingEvent
 loggingEvent) Unknown
        
log4net.dll!log4net.Appender.AppenderSkeleton.DoAppend(log4net.Core.LoggingEvent
 loggingEvent)  Unknown
        
log4net.dll!log4net.Util.AppenderAttachedImpl.AppendLoopOnAppenders(log4net.Core.LoggingEvent
 loggingEvent)     Unknown
        
log4net.dll!log4net.Repository.Hierarchy.Logger.CallAppenders(log4net.Core.LoggingEvent
 loggingEvent)   Unknown
        log4net.dll!log4net.Repository.Hierarchy.Logger.ForcedLog(System.Type 
callerStackBoundaryDeclaringType, log4net.Core.Level level, object message, 
System.Exception exception)   Unknown
        log4net.dll!log4net.Repository.Hierarchy.Logger.Log(System.Type 
callerStackBoundaryDeclaringType, log4net.Core.Level level, object message, 
System.Exception exception) Unknown
        log4net.dll!log4net.Core.LogImpl.WarnFormat(string format, object arg0, 
object arg1, object arg2)       Unknown
{quote}

The normal logging, will also generate errors, in this case the file is not 
rolled, but instead the logfile is rewritten
{quote}
log4net:ERROR RollingFileAppender: INTERNAL ERROR. Append is False but 
OutputFile [C:\Temp\log\myLog.txt] already exists.
log4net:WARN Cannot RollFile [C:\Temp\log\myLog.1.txt] -> 
[C:\Temp\log\myLog.2.txt]. Source does not exist
log4net:ERROR RollingFileAppender: INTERNAL ERROR. Append is False but 
OutputFile [C:\Temp\log\myLog.txt] already exists.
log4net:WARN Cannot RollFile [C:\Temp\log\myLog.2.txt] -> 
[C:\Temp\log\myLog.3.txt]. Source does not exist
log4net:WARN Cannot RollFile [C:\Temp\log\myLog.1.txt] -> 
[C:\Temp\log\myLog.2.txt]. Source does not exist
log4net:ERROR RollingFileAppender: INTERNAL ERROR. Append is False but 
OutputFile [C:\Temp\log\myLog.txt] already exists.
{quote}

> RollingFileAppender cannot be used by multiple process
> ------------------------------------------------------
>
>                 Key: LOG4NET-485
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-485
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.13, 1.2.14, 1.3.0
>            Reporter: NN
>            Assignee: Dominik Psenner
>             Fix For: 1.2.14
>
>
> RollingFileAppender doesn't acquire lock when rolling takes place.
> As a consequence running multiple instances of the same program rewrites the 
> same log file instead of making a roll for everyone.
> There is FileAppender.InterProcessLock but it only protects writes and not 
> rolls.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to