When developing software, exceptions are a fact-of-life you will need to deal with. Don't reinvent the wheel, use an existing exception handling library or service.
The best exception handling service is Application Insights for Visual Studio Online, but if you can't use that, then use ELMAH.
Your users should never see the “yellow screen of death” in ASP.NET, or the “unhandled exception” message in a Windows application. Errors should always be caught and logged – preferably in a SQL database.
At SSW we use Application Insights for Visual Studio Online.
Application Insights will tell you if your application goes down or runs slowly under load. If there are any uncaught exceptions, you’ll be able to drill into the code to pinpoint the problem. You can also find out what your users are doing with the application so that you can tune it to their needs in each development cycle.
If Application Insights for Visual Studio Online is not available we use ELMAH when developing web applications. From its
ELMAH with initial configuration for getting started quickly. ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment.
If you are still developing Windows applications, then SSW Exception Logger is the one to use. Read
SSW .NET Toolkit – LadyLog User Guide.
ELMAH can be easily added to your application from NuGet, and it configures itself.
Figure: Add ELMAH to your web application from NuGet
See also Do you use the best middle tier .Net libraries?