In this article, we will discuss how to write an 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.
You May Also like the Following SharePoint Online Tutorials:
Download FREE SharePoint 2019 Installation PDF Guide
This FREE PDF contains, Steps by step guide to install SharePoint 2019 Preview, prerequisites, hardware and software new features. First impression to SharePoint Server 2019 new modern site, modern lists and modern document libraries.