[
https://issues.apache.org/jira/browse/LOG4NET-485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15279006#comment-15279006
]
Blake Raymond edited comment on LOG4NET-485 at 5/11/16 6:56 PM:
----------------------------------------------------------------
We have two processes sharing a log file using RollingFileAppender running
under different users. One is a Windows service running as Local 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 Local 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 Local System process is able to open it.
{noformat}
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()
{noformat}
<call stack truncated>
was (Author: blake.raymond):
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.
{noformat}
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()
{noformat}
<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)