如何在关键级别记录事件日志

如何在关键级别记录事件日志

本文介绍了如何在关键级别记录事件日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将EventViewer中的条目记录为Critical,但是我没有关联EventLogType:

I want to log an Entry in the EventViewer as Critical but I don't have the EventLogType associated :

System.Diagnostics.EventLog.WriteEntry("ApplicationName", message, System.Diagnostics.EventLogEntryType.Error);

根据MSDN, EventLogEntryType 仅具有5个可能的值:

According to the MSDN, the EventLogEntryType have only 5 possible values :

Error
Warning
FailureAudit
Information
SuccessAudit

在EventViewer中,严重性分为5级:

And in the EventViewer, there is 5 level of severity :

Critical
Error
Warning
Information
Verbose

但是它没有被映射!错误记录在错误中警告登录警告但是FailureAudit,Information和SuccessAudit会登录Information

But it is not mapped !Error logs in ErrorWarning logs in WarningBut FailureAudit, Information and SuccessAudit logs in Information

您是否知道如何使用EventLog.WriteEvent记录严重事件?

Do you have any idea of how I can log a Critical Event with EventLog.WriteEvent ?

推荐答案

我相信它仅由系统本身生成:

I believe that It is only generated from System itself:

源MSDN

这篇关于如何在关键级别记录事件日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 13:07