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 "Blake Raymond (JIRA)" <ji...@apache.org> on 2016/05/10 21:39:13 UTC

[jira] [Commented] (LOG4NET-485) RollingFileAppender cannot be used by multiple process

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

Blake Raymond commented on LOG4NET-485:
---------------------------------------

We have two processes sharing a log file using RollingFileAppender running under different users. One is a Windows service running as SYSTEM and the other is IIS running as NETWORK SERVICE, with default permissions for those users on Windows Server 2012. We are finding that if the SYSTEM process is the one to create the named mutex for rolling, the NETWORK SERVICE process is unable to open it and receives an access denied error during ActivateOptions for the RollingFileAppender. The reverse order works - if the NETWORK SERVICE process creates the mutex, the SYSTEM process is able to open it.

System.UnauthorizedAccessException: Access to the path 'C__ProgramData_*********************.log' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.Threading.Mutex.MutexTryCodeHelper.MutexTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.Mutex.CreateMutexWithGuaranteedCleanup(Boolean initiallyOwned, String name, Boolean& createdNew, SECURITY_ATTRIBUTES secAttrs)
   at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew, MutexSecurity mutexSecurity)
   at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew)
   at log4net.Appender.RollingFileAppender.ActivateOptions()
<call stack truncated>





> 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)