none
EventLog.Level issue RRS feed

  • Question

  • Hello, 

    I am writing an application that has to monitor EventLog for SharePoint related entries in particular. I am subscribing to and processing System.Diagnostics.EventLog.EntryWritten event. 

    The problem is that System.Diagnostics.EventLogEntryType enumeration which defines the Level column in the EventViewer, doesn't contain "Critical".  What I am receiving in the EntryWrittenEventArgs.Entry.EntryType for "Critical" SharePoint events is 0.

    Is there any way to get the actual Level, not just zero? This is not SharePoint specific thing in fact, some other applications also use their own levels...

    Thanks a lot!

    Friday, August 12, 2016 5:05 AM

Answers

  • Can you post the event XML shown by Event Viewer?

    In the older Event Logging API of Win32, the ReportEvent function does not support a "Critical" level. Windows Vista introduced the newer Windows Event Log API, in which the EventManifest schema supports the win:Critical level. The System.Diagnostics.EventLog class and the System.Diagnostics.EventLogEntryType enumeration have not been updated for the newer API but there are new classes in the System.Diagnostics.Eventing.Reader namespace.

    • Marked as answer by fly2 Friday, August 12, 2016 4:57 PM
    Friday, August 12, 2016 6:58 AM

All replies

  • Can you post the event XML shown by Event Viewer?

    In the older Event Logging API of Win32, the ReportEvent function does not support a "Critical" level. Windows Vista introduced the newer Windows Event Log API, in which the EventManifest schema supports the win:Critical level. The System.Diagnostics.EventLog class and the System.Diagnostics.EventLogEntryType enumeration have not been updated for the newer API but there are new classes in the System.Diagnostics.Eventing.Reader namespace.

    • Marked as answer by fly2 Friday, August 12, 2016 4:57 PM
    Friday, August 12, 2016 6:58 AM
  • Thank you very much Kalle Olavi Niemitalo!

    I was not aware of System.Diagnostics.Eventing.*.  I know now where to dig. 

    Friday, August 12, 2016 5:00 PM