September 06, 2009

Tickle Me ELMAH

I came across a utility the other day that, in my opinion, just Gets It Right™. It’s easy to install, easy to configure, easy to use, and it’s got just the features you need, nothing more. It gets out of your way, and unobtrusively does its work. It’s free and open source. What more can you ask for?

The utility is called ELMAH. It’s an exception logging tool, and it’s unfortunate name is an acronym for “Error Logging Modules And Handlers”. Its Google Code site at http://code.google.com/p/elmah/ describes itself as:
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.
Once ELMAH has been dropped into a running web application and configured appropriately, you get the following facilities without changing a single line of your code:
  • Logging of nearly all unhandled exceptions.
  • A web page to remotely view the entire log of recoded exceptions.
  • A web page to remotely view the full details of any one logged exception.
  • In many cases, you can review the original yellow screen of death that ASP.NET generated for a given exception, even with customErrors mode turned off.
  • An e-mail notification of each error at the time it occurs.
  • An RSS feed of the last 15 errors from the log.
I remember first reading about ELMAH a few months ago on Scott Hanselman’s blog, which led me to a Phil Haack blog post and then to Jeff Atwood’s Coding Horror. All of them have nothing but good things to say about ELMAH, and how easy it is to get up and running.