I like knowing when something goes wrong with my web apps, so I’m using Super Exception Notifier to get by email a report should any exception be raised in the app. If you go to Super Exception Notifier’s site you’ll see some instructions on how to add it to your project. This is how I do it.
Add the gem requirement in environment.rb:
config.gem 'super_exception_notifier', :version => '~> 2.0.0', :lib => 'exception_notifier'
Then be sure to have gemcutter in your gem sources:
gem sources *** CURRENT SOURCES *** http://gemcutter.org http://gems.rubyforge.org/ http://gems.github.com
If you don’t have it, you can add it this way:
gem install gemcutter
To install the gem, in your Rails project run:
sudo rake gems:install
Create a file in config/initializers, I’ve called it exception_notifier.rb and inside I’ve set up the only really needed value for the notifications, the email address:
# Notification configuration ExceptionNotifier.configure_exception_notifier do |config| config[:exception_recipients] = %w(firstname.lastname@example.org) end
The last task is to make your application controller noisy by adding one line to it (the second one of course):
class ApplicationController < ActionController::Base include ExceptionNotifiable #... end
You also need to be sure that you have ActionMailer properly configured, otherwise no mail is going to get through.