企业库未正确记录严重性

igg*_*ran 1 logging enterprise-library event-log enterprise-library-5

我对企业库5有问题。它正在将要写入的所有信息写入事件日志,但是,它不遵守我配置的严重性设置。

我的异常处理配置块如下所示:

<exceptionHandlers>
  <add name="Logging Exception Handler"
       type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging...,"
       logCategory="General"
       eventId="10000"
       severity="Critical"
       title="My unknown error"
       formatterType="Micros...ExceptionFormatter, Micros...ExceptionHandling"
       priority="0" />
</exceptionHandlers>
Run Code Online (Sandbox Code Playgroud)

我的事件日志侦听器模板以以下内容开头:

Severity: {severity}{newline}
Run Code Online (Sandbox Code Playgroud)

事件日志条目记录为“错误”,而不是“严重”,但是实际记录的消息包含文本“严重性:严重”

是否有关于我实际上如何将异常记录为Critical的指针而不必实际编写自己的异常处理程序/格式化程序的任何指针?

Ran*_*ica 5

您看到的行为是.NET API的一部分。

EventLogEntryType枚举中没有用于记录到事件日志的严重级别或严重级别。 TraceEventTypeEnterprise Library和.NET跟踪基础结构所使用的,确实支持严重级别。

但是,在System.Diagnostics.EventLogTraceListener用于登录到EventLog的内,将Critical TraceEventType转换为Error EventLogEntryType

在事件查看器有对关键的过滤器,但似乎这个水平是保留给低级别的错误。例如与内核相关。