Exception Notification Gem and Rails 3
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
Darren Hinderer
Updated on July 17, 2022Comments
-
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 over 13 yearsYes 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 over 13 yearsThe
:git
part is also crucial. The latest published gem (2.3.3.0 right now) does not work with Rails 3. -
Braden Becker about 13 yearsI think this is a fork of the main project, you can just use gem 'exception_notification', :require => 'exception_notifier'
-
William Denniss about 13 yearsBraden's right -
gem 'exception_notification', :require => 'exception_notifier'
works now -
sscirrus over 12 yearsInitializer? What file/where is this?
-
gtd over 12 years@sscirrus Just create a file named whatever you want in config/initializers/
-
PabloJimeno almost 11 yearsSure, but this catches all the exceptions. It won't render anything.