Subscribe

Are you using exception logging in your web application?

One of my favorite rails plugins is exception notifier. This plugin will send you an email whenever an exception is generated by your application. This information includes:

  • the request and parameters that caused the exception
  • a stack trace
  • the contents of the users session.
  • the values of all the environment variables

In most web development frameworks it is easy to override the exception-handling mechanism to add code to email you (or store it somewhere) all this information whenever there is an exception generated. This is one of the first things I do now whenever other people start to use an application I’m working on.

Why should you be doing this?

  • Find bugs: This can be invaluable for finding and fixing bugs in your application. You don’t miss any exceptions generated by users. Users will exercise the system in strange ways and cover conditions you didn’t think of during development.

  • Reproduce bugs: User reported bugs can be vague and difficult to reproduce. This approach ensures that you have have all the information you can get about the bug and should make it easy to reproduce it and write a unit test to cover it.

  • Make users happy: You can contact users to let them know you’re looking into the problem. Users seem to like it if you email them to tell them you’re working on fixing an error before they’ve even reported it.