@RMD,你是对的。当引发异常(例如事件日志已满)时,该异常会导致该类别的所有其他跟踪侦听器不被处理。
任何 跟踪侦听器都不会记录日志条目。
另一方面,这不完全正确。是的,所有常规跟踪侦听器都不会被处理,但仍然存在特殊源错误。我建议将其设置为自己的文件(在我的经验,事件日志将给予权限等更多的问题)来捕获任何记录错误:
<specialSources>
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Error Flat File Destination" />
</listeners>
</errors>
</specialSources>
如果是这样的设置适当的权限和磁盘不是满(等),那么你会看到该日志文件中的错误与原始信息一起:
Message: Tracing to LogSource 'Your Event Source' 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:
======================================
[Original Log Entry]
Exception Information Details:
======================================
Exception Type: System.ComponentModel.Win32Exception
NativeErrorCode: 1502
ErrorCode: -2147467259
Message: The event log file is full
Data: System.Collections.ListDictionaryInternal
TargetSite: Void InternalWriteEvent(UInt32, UInt16, System.Diagnostics.EventLogEntryType, System.String[], Byte[], System.String)
HelpLink: NULL
Source: System
所以,你会得到你也许能够提取和手动插入到任何记录您的原始日志信息您保存的历史记录(例如报告,分析)。另外作为奖励,你会得到有关为什么无法写入日志条目的信息,以便它可以(希望!)得到补救。