Ryan Williams.org

The random babblings of a software developer

Fork-me

Exception Notification in Rails 3

One thing I liked about Django was the email notification it sends when an exception occurs on the server. Ruby on Rails has a plugin called Exception Notification which does the same thing.

The installation instructions in the README file aren’t really complete. So here’s how to get it up and running in Rails 3.

Edit your Gemfile and add the following line

gem "exception_notification",
        :git => "git://github.com/rails/exception_notification.git",
        :require => "exception_notifier"

Then run bundle to install it.

Once that’s done you need to create a file named config/initializers/exception_notification.rb and populate it with:

YourAppName::Application.config.middleware.use ExceptionNotifier,
  :email_prefix => "[ERROR] ",
  :sender_address => '"Notifier" <notifier@yourdomain.com>',
  :exception_recipients => ['exceptions@yourdomain.com']

From then on you will receive an email to exceptions@yourdomain.com that contains a tonne of information to help you diagnose what caused the error.

Posted

Comments

toronto maple leafs vs calgary flames

ago, toronto maple leafs vs calgary flames said

oh really, i was searching the instruction to install Rain3….. it really works.

Jason Aldean

ago, Jason Aldean said

your post is just what i was looking for. thanks a billion for sharing. now i would easily be doing my project. thanks again.

Katy Perry

ago, Katy Perry said

well, you sure are doing a good job with your blog. keep the good posts coming and ill keep coming back.

best free mmorpg 2011

ago, best free mmorpg 2011 said

Hey
can anyone help me?
I need a cost-free Mmo that features a large number of gamers and they also (perfectly most of them) can speak English. It’s important that the servers have a wide range of players. I am looking for something similar to Diablo or maybe Wow. I am also not willing to pay any money as I only have some time to destroy at this time. It’s ok if the particular game cost nothing with premium content. I’ve looked a lot regarding MMORPGs but none of the websites definitely say exactly how much players tend to be online.
thank you

iPhone 2011

ago, iPhone 2011 said

When is actually the actual iphone 5 likely to be released? I have verizon and would certainly like to get the apple iphone when my personal agreement comes to an end in June, I would prefer to figure out if the i phone five is coming out anytime soon, because if so, I might stick it out longer to get that instead of the apple iphone 4.

Andy

ago, Andy said

Thanks Ryan! The line :require => “exception_notifier” was important!!

I couldn’t figure out for the longest time why my app was giving error about “uninitialized constant ExceptionNotifier”
Now I realize the gem directory is exception_notification, thus the need to specify this :require line in the Gemfile

Thanks for your help.

Car Hire Alicante

ago, Car Hire Alicante said

Maybe you’ll want to put a twitter button to your site. I just marked down this blog, although I had to make it by hand. Simply my suggestion.

Chris Le

ago, Chris Le said

This works! :require => “exception_notifier” was the key

dislopieshile

ago, dislopieshile said

What do you mean?

Add Comment

If you want to add a comment, then simply fill in the form below. All fields are required.