logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brandon Johnson (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LOG4NET-525) RollingFileAppender initialization throws UnauthorizedAccessException while creating a mutex
Date Thu, 08 Sep 2016 19:59:20 GMT
Brandon Johnson created LOG4NET-525:

             Summary: RollingFileAppender initialization throws UnauthorizedAccessException
while creating a mutex
                 Key: LOG4NET-525
                 URL: https://issues.apache.org/jira/browse/LOG4NET-525
             Project: Log4net
          Issue Type: Bug
    Affects Versions: 1.2.15
            Reporter: Brandon Johnson


My team upgraded our ASP.NET web application from log4net 1.2.13 to 1.2.15 and lost logging
functionality in one of our QA environments. log4net's internal logging reports:

log4net:ERROR Could not create Appender [RollingLogFileAppenderServerQual] of type [log4net.Appender.RollingFileAppender].
Reported error follows.
System.UnauthorizedAccessException: Access to the path 'D__AppLogs_AMS_AMSLogQual.log' is
   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)

After some confusion on our end I confirmed that downgrading log4net back to 1.2.13 avoids
the problem. I am seeing similar bug reports from other users, often under different circumstances.
E.g. LOG4NET-506 is about the parent folder of the log file being locked, but in our case
it's the log file.

Is remaining on 1.2.13 my only option? Or is there something I can change with my appender

<appender name="RollingLogFileAppenderServerQual" type="log4net.Appender.RollingFileAppender">
      <file value="D:\\AppLogs\\AMS\\AMSLogQual.log" />
      <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
      <appendToFile value="true" />
      <rollingStyle value="Size" />
      <maximumFileSize value="20MB" />
      <maxSizeRollBackups value="10" />
      <staticLogFileName value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%-23date [%-5thread] %-5level %logger %property{log4net:HostName}
%username - (%location) - %message%newline" />

Let me know, thanks!

This message was sent by Atlassian JIRA

View raw message