How to log an Event log in the Critical level?

£可爱£侵袭症+ 提交于 2019-12-11 01:24:32

问题


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

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

Error   
Warning 
FailureAudit
Information
SuccessAudit

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

Critical
Error
Warning
Information
Verbose

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

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


回答1:


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.

Source MSDN



来源:https://stackoverflow.com/questions/38746495/how-to-log-an-event-log-in-the-critical-level

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!