Exception Notification Gem and Rails 3

后端 未结 17 2046
野趣味
野趣味 2021-01-30 05:16

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

相关标签:
17条回答
  • 2021-01-30 06:02

    I am using rails 3.0.4 and had the same issue as above. The only solution that worked for me was to install the v1.2 of the exception_notification for rails 3 (make sure you use the correct branch/version) as a PLUGIN

    rails plugin install https://github.com/railsware/exception_notification.git
    

    and use in production.rb the code everyone mentions:

    config.middleware.use ExceptionNotifier,
      :email_prefix => "[some prefix] ",
      :sender_address => %{"Notifier" <notify@domain.com>},
      :exception_recipients => %w{recipient@domain.com}
    

    It definitely did not work for me as a gem and the readme does say " Exception Notifier Plugin for Rails " and mentions nothing about installing it as gem.

    Harry

    0 讨论(0)
  • 2021-01-30 06:04

    It seems that Rails 3 can't use this plugin in gem form. Maybe rack apps can't be loaded from gems? I installed it as a plugin instead and changed the config syntax to:

    config.middleware.use "::ExceptionNotifier"

    instead of

    config.middleware.use ExceptionNotifier

    0 讨论(0)
  • 2021-01-30 06:07

    Keep it simple silly

    In gemfile

    gem 'exception_notification', :require => 'exception_notifier'
    

    In application.rb file

      config.middleware.use ExceptionNotifier,
     :email_prefix => "[ERROR] ",
     :sender_address => %{"Exception Notifier" <Dummy_email@exapmle.com>},
     :exception_recipients => %w{Dummy_email@example.com}
    

    Your are Done.. :*

    0 讨论(0)
  • 2021-01-30 06:07

    I was able to get it to work with the following in production.rb:

    config.after_initialize do
     config.middleware.use ExceptionNotifier,
          :email_prefix => "[Whatever] ",
          :sender_address => %{"notifier" <notifier@example.com>},
          :exception_recipients => %w{exceptions@example.com}
    end
    
    0 讨论(0)
  • 2021-01-30 06:07

    till now ( 2012-Aug-03) the official site is : https://github.com/smartinez87/exception_notification, and according the README, it support Rails3 perfectly.

    step1. edit your Gemfile:

    gem 'exception_notification'
    

    step2.

    As of Rails 3 ExceptionNotification is used as a rack middleware, so you can configure its options on your config.ru file, or in the environment you want it to run. In most cases you would want ExceptionNotification to run on production. You can make it work by

    Whatever::Application.config.middleware.use ExceptionNotifier,
      :email_prefix => "[Whatever] ",
      :sender_address => %{"notifier" <notifier@example.com>},
      :exception_recipients => %w{exceptions@example.com}
    
    0 讨论(0)
提交回复
热议问题