Do you know to generate error information to Windows Event Log? Most of the Windows application will output error information to Windows Event Logs if there are issues in that application. How do we do that in C#?

We need to use System.Diagnostics namespace.

Codes to generate information to output to Windows Event Logs

EventLog myLog = new EventLog();
myLog.Source = “YourApplication”;
myLog.WriteEntry(“Error Description”, EventLogEntryType.Error);

Enjoy coding… ;)

Related Entries