Search code examples
web-servicesloggingweb-configenterprise-libraryeventlog-source

Tracing to LogSource 'All Events' failed. Enterprise Library logging error


I am getting error. I am unable to understand what causing error. There are no exception on UI. Category tables has values (Information,Exception,Debug,General). When all events failed error occurs there is no record entered into CategoryLog table. Can someone please help me to understand this error and to fix it.

Tracing to LogSource 'All Events' 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: 
====================================== -->   
Message:   Timestamp: 11/4/2014 9:35:46 PM  
Message: 'Some message'.

WebConfig:-

<listeners>
  <add name="DatabaseTraceListener" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=6.0.0.0, Culture=neutral, PublicKeyToken=########"
      listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=6.0.0.0, Culture=neutral, PublicKeyToken=#######"
      databaseInstanceName="LoggingDatabase" writeLogStoredProcName="WriteLog"
      addCategoryStoredProcName="AddCategory" 
      formatter="Text Formatter"
      traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack" />
</listeners>

<formatters>
  <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=#####"
      template="Timestamp: {timestamp}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Title:{title}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}"
      name="Text Formatter" />
</formatters>

<categorySources>
  <add switchValue="Error" name="Error">
    <listeners>
      <add name="DatabaseTraceListener" />
    </listeners>
  </add>
  <add switchValue="Information" name="Information">
    <listeners>
      <add name="DatabaseTraceListener" />
    </listeners>
  </add>
  <add switchValue="Warning" name="Warning">
    <listeners>
      <add name="DatabaseTraceListener" />
    </listeners>
  </add>
</categorySources>

<specialSources>
  <allEvents switchValue="All" name="All Events">
    <listeners>
      <add name="DatabaseTraceListener" />
    </listeners>
  </allEvents>
  <notProcessed switchValue="All" name="Unprocessed Category">
    <listeners>
      <add name="DatabaseTraceListener" />
    </listeners>
  </notProcessed>
  <errors switchValue="All" name="Logging Errors &amp; Warnings">
    <listeners>
      <add name="DatabaseTraceListener" />
    </listeners>
  </errors>
</specialSources>


Error record in log table looks like this

LogID:  ######
EventID : 6352
Priority: -1
Severity: Error 
Title   : 
Timestamp:  2014-11-10 00:55:51.770

MachineName : ########

AppDomainName:  /LM/W3SVC/3/ROOT-######

ProcessID:  5272

ProcessName:    c:\windows\system32\inetsrv\w3wp.exe

ThreadName: NULL

Win32ThreadId:  8852

Message :Tracing to LogSource 'All Events' 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: 
====================================== -->   Message:   Timestamp: 

FormattedMessage :

Solution

  • You are encountering an error logging to your database. But it seems that it is not totally catastrophic since it seems errors are being logged. This rules out a common cause such as invalid connection string.

    You need to find out what the actual error is. To do this change the errors special source to log to a file (in a location with proper permissions). So add a flat file trace listener:

    <listeners>
        <add name="DatabaseTraceListener" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=6.0.0.0, Culture=neutral, PublicKeyToken=########"
          listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=6.0.0.0, Culture=neutral, PublicKeyToken=#######"
          databaseInstanceName="LoggingDatabase" writeLogStoredProcName="WriteLog"
          addCategoryStoredProcName="AddCategory" 
          formatter="Text Formatter"
          traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack" />
        <add name="Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
            listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
            fileName="trace.log" />
    </listeners>
    

    and then set the error special source to use the flat file trace listener:

      <specialSources>
        <allEvents switchValue="All" name="All Events">
          <listeners>
            <add name="DatabaseTraceListener" />
          </listeners>
        </allEvents>
        <notProcessed switchValue="All" name="Unprocessed Category">
          <listeners>
            <add name="DatabaseTraceListener" />
          </listeners>
        </notProcessed>
        <errors switchValue="All" name="Logging Errors &amp; Warnings">
          <listeners>
            <add name="Flat File Trace Listener" />
          </listeners>
        </errors>
      </specialSources>
    

    With that setting you should hopefully see the full details of the error.