zoukankan      html  css  js  c++  java
  • Rails Gem notification_exception

    添加 Gem

    gem 'exception_notification'
    

    配置

    在 production.rb 里面配置邮件和添加 exception_notificaiton 配置

      # 配置邮件
      config.action_mailer.delivery_method = :smtp
      config.action_mailer.raise_delivery_errors = true
      config.action_mailer.smtp_settings = {
        address:              'smtp.163.com',
        port:                 25,
        domain:               '163.com',
        user_name:            'sender_email@163.com',
        password:             'sender_password',
        authentication:       :login,
        enable_starttls_auto:  false  }
      ActionMailer::Base.default :from => "notify <sender_email@163.com>"
      default_url_options[:host] = 'example.com'
      config.action_mailer.default_url_options = { :host => 'example.com' }
    
      # 配置异常通知
      Rails.application.config.middleware.use ExceptionNotification::Rack,
      :email => {
        :email_prefix => "[xxx bug汇报] ",
        :sender_address => %{"notify" <sender@163.com>},
        :exception_recipients => %w{receive1@163.com receive2@163.com},
        :sections => %w{request session environment backtrace}
      }
    
  • 相关阅读:
    HTML图片映射
    js数组去重问题
    Mooc--五子棋(js)小结
    js跨域问题
    HTML5新特性
    js输出
    CSS display属性学习
    理财课堂日记第1天
    磁盘性能测试方法
    一个清空数据库数据的脚本总结
  • 原文地址:https://www.cnblogs.com/laoquans/p/4768872.html
Copyright © 2011-2022 走看看