Specify EventLogEntryType : Event Log « Windows « C# / C Sharp






Specify EventLogEntryType




using System;
using System.Diagnostics;

class MainClass {
    public static void Main() {
        if (!EventLog.SourceExists("C#")) {
            EventLog.CreateEventSource("C#", "Application");
        }

        EventLog.WriteEntry(
            "C#",                          // Registered event source
            "A simple test event.",        // Event entry message
            EventLogEntryType.Information, // Event type
            1,                             // Application-specific ID
            0,                             // Application-specific category
            new byte[] { 10, 55, 200 }       // Event data
        );
    }
}
           
       








Related examples in the same category

1.Check Event Source Existance and Create Event Source
2.Write Message to system event logWrite Message to system event log
3.Get first 5 message from system event log
4.Write the Event Log Entry type as Information
5.Removes the registration for an event source if it has been registered