添加文件config/initializers/exception_notification.rb
添加以下代码
require 'exception_notification/rails'
ExceptionNotification.configure do |config|
##Send notifications if rails running in production mode
config.ignore_if do |exception, options|
not Rails.env.production?
end
##add notifier
config.add_notifier :email, {
:email_prefix => "Error Prefix ",
:sender_address => "Sender address",
:exception_recipients => ['developer1@example.com', 'developer2@example2.com'],
:delivery_method => :smtp,
:smtp_settings => {
:user_name => "User Name",
:password => "Password",
:domain => "domain",
:address => "Address",
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true
}
}
end