- 介绍
exception_notification
rails 2.3.8 https://github.com/smartinez87/exception_notification/tree/2-3-stable
rails 3 https://github.com/rails/exception_notification
- install plugin
ruby script/plugin install git://github.com/rails/exception_notification.git -r '2-3-stable' - configuration
将如下代码加入到environment.rb的最后
2.3 update application_controller.rbExceptionNotification::Notifier.exception_recipients = %w(hexudong08@gmail.com) #接受错误的邮件 ExceptionNotification::Notifier.sender_address = %("Application Error" <yunshiteam@rayclear.com>) #发送错误的邮件 |ExceptionNotification::Notifier.email_prefix = "[APP]" #定义发送错误的级别,默认是ERROR
include ExceptionNotification::Notifiable
- 如何想能development环境下测试,需要增加如下代码至application_controller.rb
并修改config/environments/development.rbdef local_request? false end
config.action_controller.consider_all_requests_local = false config.action_mailer.raise_delivery_errors = true
- rails2如何配置发送邮件?
- 资料
https://github.com/rails/exception_notification/tree/2-3-stable
- rails3中的配置
新增gem
gem 'exception_notification', :require => 'exception_notifier'
config/application.rb文件
config.middleware.use ExceptionNotifier, :email_prefix => "[APP] ", :sender_address => %{"异常通知" <xxxxx@xxxxxx.com>}, :exception_recipients => %w{xxxxx@163.com}
更多具体的使用
https://github.com/smartinez87/exception_notification
http://www.taobaotest.com/blogs/qa?bid=13030
http://stackoverflow.com/questions/3524127/exception-notification-gem-and-rails-3
http://www.stormconsultancy.co.uk/blog/development/basic-exception-notification-in-rails-3/
rails开发利器:时刻监控我们的程序错误rails exception_notification
最新推荐文章于 2024-09-20 09:00:38 发布