Logging Fails after Application Pool Recycle

Topics: Logging Application Block
May 2, 2008 at 5:59 PM
I have a situation where the Logging fails to continue after the application pool is restarted. This typically happens when the App pool is not gracefully restarted. We have to pools set to automatically restart once a day. I am using the RollingFlatFileTraceListener. Everything works fine if the AppPools gracefully reset, however, when it is unable to cycle in 120 seconds it is not very graceful. Is there a setting in the config I am missing?

<add fileName="rolling.log" rollSizeKB="20480" timeStampPattern="yyyy-MM-dd" rollFileExistsBehavior="Overwrite" rollInterval="Week" formatter="Log Entry Formatter" header="" footer="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null"
traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=null"
name="Rolling Flat File Trace Listener" />
May 5, 2008 at 4:43 PM
Hi,

What kind of failure are you seeing?

Fernando
May 5, 2008 at 8:26 PM
We are not seeing any signs of failure other than logs do not get updated. There are new event log entries. This problem does not correct itself. Our current fix is to manually recycle the app pool then logging begins as normal.



fsimonazzi wrote:
Hi,

What kind of failure are you seeing?

Fernando

Jul 2, 2008 at 7:00 PM
I have noticed a similar situation in one of our web application that's in production.  But it's not clear why the logging fails to continue was it because of restarting the application pool or some other reason.  We are using Exception Handling Block and Logging Application Block .  Below is the configuration for logging component:

<loggingConfiguration defaultCategory="Default Category" tracingEnabled="false">
  <logFilters>
   <add name="Category" type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.CategoryFilter, Microsoft.Practices.EnterpriseLibrary.Logging" categoryFilterMode="AllowAllExceptDenied">
    <categoryFilters/>
   </add>
   <add name="Priority" type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.PriorityFilter, Microsoft.Practices.EnterpriseLibrary.Logging" minimumPriority="0"/>
  </logFilters>
  <categorySources>
   <add name="Default Category" switchValue="All">
    <listeners>
     <add name="Event Log Destination"/>
    </listeners>
   </add>
   <add name="Tracing" switchValue="All">
    <listeners>
     <add name="Flat File Destination"/>
    </listeners>
   </add>
  </categorySources>
  <specialSources>
   <errors name="errors" switchValue="All">
    <listeners>
     <add name="Event Log Destination"/>
          <add name="Flat File Destination"/>
        </listeners>
   </errors>
  </specialSources>
  <listeners>
   <add name="Event Log Destination" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging" source="Enterprise Library Logging" formatter="Default Formatter"/>
   <add name="Flat File Destination" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging" fileName="trace.log"/>
  </listeners>
  <formatters>
   <add name="Default Formatter" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging" template="Timestamp: {timestamp}&#xA;      Message: {message}&#xA;      Category: {category}&#xA;      Priority: {priority}&#xA;      EventId: {eventid}&#xA;      Severity: {severity}&#xA;      Title:{title}&#xA;      Machine: {machine}&#xA;      Application Domain: {appDomain}&#xA;      Process Id: {processId}&#xA;      Process Name: {processName}&#xA;      Win32 Thread Id: {win32ThreadId}&#xA;      Thread Name: {threadName}&#xA;      Extended Properties: {dictionary({key} - {value}&#xA;      )}"/>
  </formatters>
 </loggingConfiguration>

 

Jul 2, 2008 at 8:37 PM
There is an issue with the RollingFlatFileTraceListener when impersonation is used, but this doesn't seem to be the case. Which version of OS and IIS are you using?

Fernando
Jul 8, 2008 at 7:29 PM
The OS Version is Windows Server 2003, Standard Edition, Server Pack 1 and IIS 6.0 .NET 2.0.

Also, we don't have any configuration related to RollingFlatFileTraceListener, but we use impersonation and below is how it's configured in our web app:

<identity impersonate="true"/>
    <authorization>
      <allow users="*"/>
      <deny users="?" />
    </authorization>