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 "Erik Källén (JIRA)" <ji...@apache.org> on 2017/03/30 07:58:41 UTC

[jira] [Created] (LOG4NET-560) UnauthorizedAccessException in RollingFileAppender when acquiring a mutex

Erik Källén created LOG4NET-560:
-----------------------------------

             Summary: UnauthorizedAccessException in RollingFileAppender when acquiring a mutex
                 Key: LOG4NET-560
                 URL: https://issues.apache.org/jira/browse/LOG4NET-560
             Project: Log4net
          Issue Type: Bug
            Reporter: Erik Källén


I have a setup where I want two processes, running as different user accounts to log to the same file.

I have set up the file permissions so they work, but the second process that starts cannot perform the logging due to this error:

log4net:ERROR Could not create Appender [myAppender] of type [log4net.Appender.RollingFileAppender]. Reported error follows.
System.UnauthorizedAccessException: Access to the path 'E__Log_MyLog.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)
   at log4net.Appender.RollingFileAppender.ActivateOptions()
   at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement appenderElement)

I think the mutex should be created with access for Everyone, and that would solve the problem.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)