Exception Notification Gem and Rails 3

27,605

Solution 1

All previous answers are outdated, you can now simply add this to your gemfile:

gem 'exception_notification', :require => 'exception_notifier'

And edit your production.rb config file as indicated in the readme:

config.middleware.use ExceptionNotifier,
  :email_prefix => "[Exception] ",
  :sender_address => %{"Exception Notifier" <[email protected]>},
  :exception_recipients => %w{[email protected]}

Solution 2

Latest version of official gem works with Rails 3, you can find it here: https://github.com/smartinez87/exception_notification.

Next gem release will make the :require => 'exception_notifier' option unnecessary.

Solution 3

Ok, its working now for me:

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

# application.rb, inside the config block
config.middleware.use ::ExceptionNotifier,
  :email_prefix => "ApplicationName-Errors: ",
  :sender_address => %w{[email protected]},
  :exception_recipients => %w{[email protected]}

Solution 4

Keep it simple silly

In gemfile

gem 'exception_notification', :require => 'exception_notifier'

In application.rb file

  config.middleware.use ExceptionNotifier,
 :email_prefix => "[ERROR] ",
 :sender_address => %{"Exception Notifier" <[email protected]>},
 :exception_recipients => %w{[email protected]}

Your are Done.. :*

Solution 5

It seems that Rails 3 can't use this plugin in gem form. Maybe rack apps can't be loaded from gems? I installed it as a plugin instead and changed the config syntax to:

config.middleware.use "::ExceptionNotifier"

instead of

config.middleware.use ExceptionNotifier

Share:
27,605
Darren Hinderer
Author by

Darren Hinderer

Updated on July 17, 2022

Comments

  • Darren Hinderer
    Darren Hinderer almost 2 years

    I'm trying to get this up and running, but I see "uninitialized constant ExceptionNotifier" whenever I start my server.

    http://github.com/rails/exception_notification

    In my Gemfile I have

    gem "exception_notification", :git => "http://github.com/rails/exception_notification.git", :branch => "master"

    I've tried putting the configuration as shown in the github readme inside of config/application.rb, config/environment.rb, and config.ru. I replaced "Whatever" with my application name.

  • nathanvda
    nathanvda over 13 years
    Yes definitely. I use the above line in my Gemfile, and in my application.rb i have the config.middleware.use ... and that's all i needed to do. Do you still have the uninitialized constant error?
  • Steve Madsen
    Steve Madsen over 13 years
    The :git part is also crucial. The latest published gem (2.3.3.0 right now) does not work with Rails 3.
  • Braden Becker
    Braden Becker about 13 years
    I think this is a fork of the main project, you can just use gem 'exception_notification', :require => 'exception_notifier'
  • William Denniss
    William Denniss about 13 years
    Braden's right - gem 'exception_notification', :require => 'exception_notifier' works now
  • sscirrus
    sscirrus over 12 years
    Initializer? What file/where is this?
  • gtd
    gtd over 12 years
    @sscirrus Just create a file named whatever you want in config/initializers/
  • PabloJimeno
    PabloJimeno almost 11 years
    Sure, but this catches all the exceptions. It won't render anything.