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_notificatio
Using Rails 3.0.3 this works for me:
gem "exception_notification", :git => "https://github.com/sickill/exception_notification.git", :require => 'exception_notifier'
:git part is imported because its a patched version to get around the 'undefined method controller_name error' and :require to require the right lib.
Then in my production.rb environment file i only have this (from the manual)
config.middleware.use ExceptionNotifier,
:email_prefix => "[MyApp] ",
:sender_address => %{"notifier" <email@example.com>},
:exception_recipients => %w{email@example.com}
Seems like there are many different ways to get this to work, but this was my way.
Cheers!
https://github.com/smartinez87/exception_notification
This gem has been updated for rails 3.x and I just tested on 3.0.7 and the installation is much simpler.
Gemfile:
gem 'exception_notification'
Initializer:
Rails.application.config.middleware.use ExceptionNotifier,
:email_prefix => "[Whatever] ",
:sender_address => %{"notifier" <notifier@example.com>},
:exception_recipients => %w{exceptions@example.com}
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{office@application.com},
:exception_recipients => %w{office@application.com}
UPDATED ANSWER as of 3/14...
You just need to do gem exception_notification
in your gem file. No 'require' needed.
Also, other changes just straight from the docs...
"As of 4.x version the configuration syntax has changed. All email related options MUST BE nested under the :email key."
like so...
Whatever::Application.config.middleware.use ExceptionNotification::Rack,
:email => {
:email_prefix => "[Whatever] ",
:sender_address => %{"notifier" <notifier@example.com>},
:exception_recipients => %w{exceptions@example.com}
}
The official repo on github is now: https://github.com/smartinez87/exception_notification
In the Gemfile
gem "exception_notification", :require => 'exception_notifier', :git => "https://github.com/smartinez87/exception_notification.git"
In config\initializers\exception_notification.rb
Rails.application.config.middleware.use ExceptionNotifier,
:email_prefix => "[Whatever] ",
:sender_address => %{"notifier" <notifier@example.com>},
:exception_recipients => %w{exceptions@example.com}
I copied and pasted the exception_notification config from old app to new one and it failed.
It brought me here and none of the above answers were up-to-date.
Since 4.x version the middleware was renamed to ExceptionNotification::Rack
,
so middleware config looks like that:
Whatever::Application.config.middleware.use ExceptionNotification::Rack,
:email => {
:email_prefix => "[Whatever] ",
:sender_address => %{"notifier" <notifier@example.com>},
:exception_recipients => %w{exceptions@example.com}
}