企业库未正确记录严重性

企业库未正确记录严重性

本文介绍了企业库未正确记录严重性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a problem with enterprise library 5. It's writing to the event log all the information I want it to write, however, it is not respecting the severity settings I configure.

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

My exception handling configuration block looks like this:

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

我的事件日志侦听器模板开头为:

My event log listener template starts with:

Severity: {severity}{newline}

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

The event log entry is logged as "Error", not "Critical", however the message that is actually logged contains the text "Severity: Critical"

关于如何真正将异常记录为Critical而不需要实际编写自己的异常处理程序/格式化程序的任何指针?

Any pointers as to how I can actually log an exception as Critical without having to actually write my own exception handler/formatter?

推荐答案

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

The behavior you are seeing is part of the .NET API.

枚举,用于登录到EventLog. TraceEventType ,它被企业库用作和.NET跟踪基础结构一样,确实支持严重级别.

There is no level or severity of Critical in the EventLogEntryType Enumeration which is used to log to the EventLog. TraceEventType, which is used by Enterprise Library as well as the .NET tracing infrastructure, does support a Critical severity.

但是,在用于记录到事件日志的System.Diagnostics.EventLogTraceListener内,严重的TraceEventType会转换为错误EventLogEntryType.

However, inside the System.Diagnostics.EventLogTraceListener, which is used to log to the EventLog, a Critical TraceEventType is converted to an Error EventLogEntryType.

在事件查看器中,过滤器,用于严重",但似乎该级别是为低级别错误保留的.例如.内核相关.

In the Event Viewer there is a filter for Critical but it seems that this level is reserved for low level errors. E.g. kernel related.

这篇关于企业库未正确记录严重性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 22:57