How to log errors (Exceptions) in your ASP.NET apps

asp.neterror-handlinghealth-monitoringnlog

I'm looking for the best way to log errors in an ASP.NET application.
I want to be able to receive emails when errors occurs in my application, with detailed information about the Exception and the current Request.

In my company we used to have our own ErrorMailer, catching everything in the Global.asax Application_Error. It was "Ok" but not very flexible nor configurable.

We switched recently to NLog. It's much more configurable, we can define different targets for the errors, filter them, buffer them (not tried yet). It's a very good improvement.

But I discovered lately that there's a whole Namespace in the .Net framework for this purpose : System.Web.Management and it can be configured in the healthMonitoring section of web.config.

Have you ever worked with .Net health monitoring? What is your solution for error logging?

Best Solution

I use elmah. It has some really nice features and here is a CodeProject article on it. I think the StackOverflow team uses elmah also!