In this article we will discuss how to write exception to Event Log in Asp.Net. You can check my previous posts on:
Event log will be accessible from Start -> Run -> eventvwr. To write the exception message in the Event log is now easy in .Net by use of the namespace System.Diagnostics;
Below is the code to write to event log:
catch (System.Exception ex)
EventLog log = new EventLog();
log.Source = “Comes from .Net Application”;
// Clean up block.
Here in the above code the exception message will be written in the event log with source as “Comes from .Net Application”.
Now open the event viewer window ( Start -> Run -> eventvwr ) and Navigate to Windows Logs -> Application , You will able to see the error message.
Similar SharePoint 2013 Tutorials