Log4net
  1. Log4net
  2. LOG4NET-293

IIS hangs using log4net with Global.asax initialization in Application_Start event

    Details

      Description

      Hi there!

      I have an issue regarding log4net.
      log4net hangs the application pool process. Analysing dump files created from w3wp.exe we can notice a bad behavior when it trys to write a new log file as you can see below:

      0196e700 758102b8 kernel32!RaiseException(unsigned long dwExceptionCode = 0x40010006, unsigned long dwExceptionFlags = 0, unsigned long nNumberOfArguments = 2, unsigned long * lpArguments = 0x0196e728)+0x58

      0196e96c 757dbe85 kernel32!OutputDebugStringA(char * lpOutputString = 0x01e75930 "log4net:WARN RollingFileAppender: Cannot RollFile [C:\sites\waterfall2\logs\logfile.xlog.16266995] -> [C:\sites\waterfall2\logs\logfile.xlog.20110620.16266995]. Source does not exist..")+0x285

      0196e98c 018c11f6 kernel32!OutputDebugStringW(wchar_t * lpOutputString = 0x062aab8c "log4net:WARN RollingFileAppender: Cannot RollFile [C:\sites\waterfall2\logs\logfile.xlog.16266995] -> [C:\sites\waterfall2\logs\logfile.xlog.20110620.16266995]. Source does not exist..")+0x41

      0196e9a8 701e02f2 CLRStub[StubLinkStub]@18c11f6(<Win32 error 0n318>)

      0196ea74 1b59aaa8 log4net!log4net.Util.LogLog.EmitErrorLine(<HRESULT 0x80004001>)+0x28

      0196ea7c 1b59aa58 log4net!log4net.Util.LogLog.Warn(<HRESULT 0x80004001>)+0x30

      0196eab8 1b59a78d log4net!log4net.Appender.RollingFileAppender.RollFile(<HRESULT 0x80004001>)+0x210

      0196eae4 1b59a4d9 log4net!log4net.Appender.RollingFileAppender.RollOverTime(<HRESULT 0x80004001>)+0x1cd

      0196eb24 1b599aa4 log4net!log4net.Appender.RollingFileAppender.RollOverIfDateBoundaryCrossing(<HRESULT 0x80004001>)+0x279

      0196eb5c 1b59914a log4net!log4net.Appender.RollingFileAppender.ExistingInit(<HRESULT 0x80004001>)+0x34

      0196eb8c 1b5943fe log4net!log4net.Appender.RollingFileAppender.ActivateOptions(<HRESULT 0x80004001>)+0x1ea

      0196ebcc 1b59407d log4net!log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(<HRESULT 0x80004001>)+0x346

      0196ec04 1b59389a log4net!log4net.Repository.Hierarchy.XmlHierarchyConfigurator.FindAppenderByReference(<HRESULT 0x80004001>)+0x18d

      0196ec38 1b5934fe log4net!log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseChildrenOfLoggerElement(<HRESULT 0x80004001>)+0xca

      0196ec6c 1b593312 log4net!log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseRoot(<HRESULT 0x80004001>)+0x46

      0196eca8 1b592f4a log4net!log4net.Repository.Hierarchy.XmlHierarchyConfigurator.Configure(<HRESULT 0x80004001>)+0x352

      0196ecbc 1b592f06 log4net!log4net.Repository.Hierarchy.Hierarchy.XmlRepositoryConfigure(<HRESULT 0x80004001>)+0x2a

      0196ecd4 1b592ee4 log4net!log4net.Repository.Hierarchy.Hierarchy.log4net.Repository.IXmlRepositoryConfigurator.Configure(<HRESULT 0x80004001>)+0x6

      0196ecd4 1b592cd7 log4net!log4net.Config.XmlConfigurator.ConfigureFromXml(<HRESULT 0x80004001>)+0xf4

      0196ed04 1b5907f8 log4net!log4net.Config.XmlConfigurator.Configure(<HRESULT 0x80004001>)+0xb7

      0196ed0c 1b5905a5 log4net!log4net.Config.XmlConfigurator.Configure(<HRESULT 0x80004001>)+0x18

      0196ed1c 71e41b4c App_global_asax_vd_tcznb!ASP.global_asax.Application_Start(<HRESULT 0x80004001>)+0x5d

      and here you can find the config file:

      <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
      <!-<file value="c:\temp\webFile.xlog" />->
      <file value="logs
      logfile.xlog" />
      <staticLogFileName value="true" />
      <appendToFile value="true" />
      <rollingStyle value="Composite" />
      <datePattern value=".yyyyMMdd" />
      <maximumFileSize value="5Mb" />
      <maxSizeRollBackups value="-1" />
      <layout type="log4net.Layout.XmlLayout">
      <locationInfo value="true" />
      </layout>
      </appender>

      In my site log4net was initialized in the following mode during at the Application_Start event in the Global.asax:
      void Application_Start(object sender, EventArgs e)

      { log4net.Config.XmlConfigurator.Configure(); }

      Is there a way to fix it?
      Thanks!

        Activity

        Nicola Achille created issue -
        Nicola Achille made changes -
        Field Original Value New Value
        Affects Version/s 1.2.10 [ 11128 ]
        Priority Major [ 3 ] Critical [ 2 ]
        Component/s Appenders [ 11601 ]
        Stefan Bodewig made changes -
        Fix Version/s 1.2 Maintenance Release [ 12317606 ]
        Dominik Psenner made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Cannot Reproduce [ 5 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Nicola Achille
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development