ASP.NET Health Monitoring or ELMAH what to choose?

Health Monitoring VS ELMAH

ASP.NET health monitoring is a set of ASP.NET runtime events for monitoring health, performance, and security, and a flexible provider-based framework for routing these events to email, eventlog, SQL server, and any other destination. we will learn about choosing between Health Monitoring VS ELMAH.

Health Monitoring VS ELMAH:

If you go on stackoverflow.com and read about people asking whether they should use Health Monitoring, ELMAH, log4net, or the Enterprise Logging Block, you will rarely find people advocating the use of Health Monitoring.  Its not because they have anything bad to say about it, in fact most of the time they don’t have anything to say – other than saying that they just ended up going with ELMAH (partially thanks to Hanselman’s endorsement), or Log4Net.

Should I use Health Monitoring or something else?

This is the question many are asking.  To keep my answer short, I would suggest: Following is criteria for choosing between Health Monitoring VS ELMAH.

  1. Use HM if you want to log / troubleshoot issues that could benefit from ASP.NET runtime events. You could still route them to your logging framework of choice.
  2. Use HM if you want to set up a very quick email report for errors in your application.  But, you probably want to use ELMAH instead for simple error logging.Of course, this breaks down VERY QUICKLY if you have a lot of traffic/errors.  At this point, you really need a monitoring solution that can properly aggregate thousands of events and let you identify the key problems across them (instead of bombarding you with hundreds of alerts).
  3. Use HM / EventLog on any server where you dont control the code, to find the errors that the application is throwing. This is my go-to when troubleshooting in production.
  4. Use a logging framework for custom application logging.  Log4net is popular.  I would not recommend Health Monitoring here because its too much of an overkill, and forces too much structure for custom application logging.

Lessons Learned

Many large software projects later, the lessons learned have often been the same when choosing Health Monitoring VS ELMAH

  1. Dont overengineer your monitoring solution.  If its too complicated, you wont benefit from it.
  2. When it comes to supporting production applications, getting the data is a (small) part of the problem. By far the biggest problem is reporting this data in a way that helps you make decisions and take action on it.

To implement the health monitoring solution i would recommend the following resources

 

Leave a Reply

Your email address will not be published. Required fields are marked *