Rolling Flat file Listener

Topics: Logging Application Block
Sep 11, 2009 at 10:39 AM

In Devlopment Servers, While rolling to a new log file we are getting an exception from the enterprise library . The error details has been given below.

Exception Information Details:
======================================
Exception Type: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Data: System.Collections.ListDictionaryInternal
TargetSite: Void PerformRoll(System.DateTime)
HelpLink: NULL
Source: Microsoft.Practices.EnterpriseLibrary.Logging

StackTrace Information Details:
======================================
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener.StreamWriterRollingHelper.PerformRoll(DateTime rollDateTime)
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener.StreamWriterRollingHelper.RollIfNecessary()
   at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener.TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, Object data)
   at Microsoft.Practices.EnterpriseLibrary.Logging.LogSource.TraceData(TraceEventType eventType, Int32 id, LogEntry logEntry, TraceListenerFilter traceListenerFilter)
   at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.ProcessLog(LogEntry log)

My config entry is :

 

 

 

 

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

<

</font></font><font size="2" color="#0000ff">

 

</font>

add fileName="E:\DATA\Web\eServe\2.3\IAT\eServe\Logs\eServeErrorLog.log"rollSizeKB="0" timeStampPattern="yyyy-MM-dd" rollFileExistsBehavior="Increment" rollInterval="Day" formatter="Text Formatter" header="----------------------------------------"footer="----------------------------------------" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" name="Rolling Flat-File Listener" />

Please let me know the reason for this issue.

 

 

 

Sep 14, 2009 at 6:19 AM

Hi,

I tried the same configuration that you've posted but does not reproduce your error. Can you provide more details? What is the OS of your development server? And also I want to confirm that the base file is successfully created but on the first time that the file will roll, the error occurs. Is that correct?

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 10, 2011 at 12:17 AM

I know this is an old topic, but I'm currently running into this issue on my WCF web service. Currently we log all incoming access to each of the web service methods. This error only occurs when there is heavy traffic on the web service, but this is to be expected. Currently running the web service on Windows Server 2008 using IIS 7.5. Currently using Enterprise Library 3.1. Any assistance on this would be greatly appreciated. After this error occurs, no logs are created.

Apr 10, 2011 at 11:39 PM
Edited Apr 11, 2011 at 12:53 AM

So you're also using a rolling flat file trace listener?  Do you have other trace listeners under the same category other than that trace listener?  If not, could you add an event log trace listener and see if both listener won't work after the said exception.

 

Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 11, 2011 at 12:13 AM

For my case, I have a general.log, trace.log, error.log, performance.log, and params.log. All have pretty much the same configuration except for the log names. All have a rollSizeKB of 1000kb. I am currently only using general.log, trace.log, and error.log. Currently we log to the trace.log for each of the public methods in the web service. When there is heavy traffic, the exception mentioned above is written to the error.log file. When the error occurs all logging to the trace.log file stops. Logging to general.log and error.log still occur. Currently my idea is to use the other logs to alleviate logging into trace.log since it is used heavily in the code. Below is pretty much the full log that I see in error.log. Any ideas on the error?

 

Error Error: 6352 : Timestamp: 4/8/2011 11:30:45 PM Message: Tracing to LogSource 'Trace' failed. Processing for other sources will continue. See summary information below for more information. Should this problem persist, stop the service and check the configuration file(s) for possible error(s) in the configuration of the categories and sinks.

Summary for Enterprise Library Distributor Service:

==========================================

Exception Information Details: ====================================== Exception Type: System.NullReferenceException Message: Object reference not set to an instance of an object. Data: System.Collections.ListDictionaryInternal TargetSite: Void PerformRoll(System.DateTime) HelpLink: NULL Source: Microsoft.Practices.EnterpriseLibrary.Logging

StackTrace Information Details: ====================================== at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener.StreamWriterRollingHelper.PerformRoll(DateTime rollDateTime) at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener.StreamWriterRollingHelper.RollIfNecessary() at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener.TraceData(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, Object data) at Microsoft.Practices.EnterpriseLibrary.Logging.LogSource.TraceData(TraceEventType eventType, Int32 id, LogEntry logEntry, TraceListenerFilter traceListenerFilter) at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.ProcessLog(LogEntry log)

Apr 11, 2011 at 1:04 AM

Sorry but I've no idea about the error, it's too general.  Please do try if adding other trace listeners other than the one associated to trace.log will work.

 

Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 11, 2011 at 1:24 AM

Hi,

Can you post the relevant config here.

 

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

 

Apr 12, 2011 at 4:22 AM
Edited Apr 12, 2011 at 10:26 PM

<add fileName="C:\logs\trace.log"rollSizeKB="1000" timeStampPattern="yyyy-MM-dd" rollFileExistsBehavior="Increment" rollInterval="Day"formatter="Text Formatter" header="----------------------------------------"footer="----------------------------------------"listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" name="Rolling Flat-File Listener" />
<add fileName="C:\logs\error.log"rollSizeKB="1000" timeStampPattern="yyyy-MM-dd" rollFileExistsBehavior="Increment" rollInterval="Day"formatter="Text Formatter" header="----------------------------------------"footer="----------------------------------------"listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" name="Rolling Flat-File Listener" />
<add fileName="C:\logs\params.log"rollSizeKB="1000" timeStampPattern="yyyy-MM-dd" rollFileExistsBehavior="Increment" rollInterval="Day"formatter="Text Formatter" header="----------------------------------------"footer="----------------------------------------"listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" name="Rolling Flat-File Listener" />

Apr 12, 2011 at 6:19 AM

Have you tried out yet to add another trace listener to the category where your trace listener which logs to error.log file is associated to?

 

Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 12, 2011 at 10:27 PM

This is currently on hold until next week so I will not be able to test it out.

Apr 13, 2011 at 8:02 PM

I am currently doing impersonation on the web service calls. Would this have anything to do with possibly permissions issue for the user that the web service impersonates?

Apr 14, 2011 at 12:53 AM

Yes, probably.  I forgot that fix in 4.1 which adds the RevertImpersonation property to the Logging Application Block.  Try setting it to false.

For your reference, this is taken from the documentation of 4.1:

"Added: Configuration support to opt-out of the impersonation-reverting default setting has been added. This fixes the rolling flat file trace listener problem when used in a Web application and when impersonation is enabled. To opt-out of the impersonation-reverting default mode, set the new <section> revertImpersonation attribute to false. The default setting is true. This supports configuration support, design time support, and manageability support (both WMI and group policy)."

 

Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com