ITeye博客

发生错误的时候发送email邮件提醒

PBFox · 2008-10-07 11:02 · Markdown

1. 安装exception_notification:

  1. rubyscript/plugininstall http://dev.rubyonrails.org/svn/rails/plugins/exception_notification/

2. 在config/environment.rb文件里面添加这样一行设置接受错误邮件的邮箱:

ExceptionNotifier.exception_recipients=%w(your@emailaddress.com)
ExceptionNotifier.sender_address = %("Application Error" <web@emailaddress.com>)

3. 在application控制器中加入include ExceptionNotifiable

classApplicationController<ActionController::Base
includeExceptionNotifiable
end

4.说明:

只在production环境中有效

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。