Search code examples
c#wpfevent-log

How to log an Event log in the Critical level?


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 ?


Solution

  • 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