跟踪LogSource的“所有事件”失败。企业库日志记录错误

时间:2014-11-10 23:04:31

标签: web-services logging web-config enterprise-library eventlog-source

我收到错误。我无法理解导致错误的原因。 UI上没有例外。 类别表具有值(信息,异常,调试,常规)。当所有事件都失败时发生错误,没有记录输入到CategoryLog表中。有人可以帮我理解这个错误并修复它。

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>


日志表中的错误记录如下所示

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 :

2 个答案:

答案 0 :(得分:0)

您在登录数据库时遇到错误。但它似乎并非完全是灾难性的,因为它似乎记录了错误。这排除了一个常见的原因,例如无效的连接字符串。

您需要找出实际错误是什么。要执行此操作,请更改错误特殊源以记录到文件(在具有适当权限的位置)。所以添加一个平面文件跟踪监听器:

<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>

然后设置错误特殊源以使用平面文件跟踪侦听器:

  <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>

使用该设置,您应该希望看到错误的完整细节。

答案 1 :(得分:0)

让用户尝试以管理员身份编写日志是此问题的解决方案。还可以更改UAC设置以使IIS用户成为管理员。