如何在关键级别记录事件日志? [英] How to log an Event log in the Critical level?

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

问题描述

我想将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 Error Warning logs in Warning But 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:

严重事件以即时消息的形式在屏幕上发送给用户.其他事件通知将写入记录事件信息以供将来参考的多个事件日志之一.

Critical events are sent to the user in the form of an immediate message on the screen. Other event notifications are written to one of several event logs that record the information for future reference.

源MSDN

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆