Sunday, November 09, 2014

Write exceptions to System Event Log.

Hi Dear friends,

I was in need to use the Operating System Event Logs, to save the c# exceptions, where I got the following information from our coder's guru... (Google)

Namespace to be included : System.Diagnostics
Classes: All classes in above mentioned namespace allow us to communicate with the System Processes, Event Logs and Performance Counters.

Following is the code snippet where I have used EventLog class default constructor to log the event to the system event viewer

Output to the above Code snippet

Thanks,
Hope it helps.

No comments: