Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-560

UnauthorizedAccessException in RollingFileAppender when acquiring a mutex

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              erik_kallen@hotmail.com Erik Källén
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: