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

Issue with Logger Initialization after IIS restart



    • Type: Bug
    • Status: Open
    • Priority: Blocker
    • Resolution: Unresolved
    • Affects Version/s: 2.0.8
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
    • Environment:
      Windows server 2012


      Hi Team,

      We are facing issue with log4net. We get stuck with file locking mechanism and all of sudden everything gets stopped working as logger instance is null. We are facing this in following scenario : 

      1) We are having website hosted in IIS which logs the info to the shared location.

      2) In case we restart the site while user performing some action, logger instance could not be initialized after restart and following error gets generated : 


      InnerException:[5/25/2018 9:04:35 PM Message : CommonMethods -> InitializeLogger

      System.UnauthorizedAccessException: Access to the path '_eZRDevTest1.in.knovos.COM_STAGGING_DATA_Logs_eZReview_Cases_DEV_EZR_WEB_Unit_Testing_dsanghvi' 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 EzRSharedObjects.CNLogger.b(String A_0, String A_1)

         at EzRSharedObjects.CNLogger.a(String A_0, String A_1)

         at EzRSharedObjects.CNLogger.Initialize(String logAppenderName, String logFolderPath, LogLevel logLevel, Boolean enableLog4netInternalDebugTrace)

         at EzReviewBusiness.CommonMethods.InitializeLogger(String caseName)


      For your information, this path is accessible to the system as we are able to create and delete the temp files on the same path. Even, logger was initialized at first time but after restart its giving error. It seems that lock on file is not released once we restart.

      Please provide the resolution and let me know if you need any further information. 







          Issue Links



              • Assignee:
                mbhaliya Mayur Bhaliya
              • Votes:
                1 Vote for this issue
                2 Start watching this issue


                • Created: