Rails Forum
Rails Work - the best place to post and find great Ruby on Rails jobs.
Username
Password

You are not logged in.

New Posts in this thread
  • Index
  •  » Tutorials
  •  » HOWTO: Exception Notifier - Ruby on Rails plugin

#1 2006-09-05 22:15:10

Dieter Komendera
First Class
From: Zistersdorf, Austria
Registered: 2006-08-10
Posts: 104
Website

HOWTO: Exception Notifier - Ruby on Rails plugin

Copy and paste from my blog: http://sas.sparklingstudios.com/article … ils-plugin

Yesterday I came over Exception Notifier.

I found it really useful because it is really easy to install and you can instantly react to Application Errors. Your customers don’t have to notify you because you get a bunch of information to track the error via email.

3 easy steps are necessary to set up Exception Notifier:
1. Install the exception_notification plugin:

ruby script/plugin install exception_notification

2. Configure exception_notification: Add following line to your config/environment.rb file:

Code :  ruby - fold - unfold
  1. ExceptionNotifier.exception_recipients = %w(your@emailaddress.com) 
3. Tell the Exception Notifier for which controller it shoud send exception notifications to you. In this example it will send notifications for all exceptions:

Code :  ruby - fold - unfold
  1. class ApplicationController < ActionController::Base
  2.     include ExceptionNotifiable
  3. end 
Thats it! Now you will be notified when an error rises.

NOTE: If your server can’t send mails, you have to configure your Rails app for sending mails! See here in section “Configuration”: http://wiki.rubyonrails.org/rails/pages … tionMailer

For advanced configuration read here: http://dev.rubyonrails.org/browser/plug … ion/README


My homepage: http://www.komendera.com/
Working at: http://www.abloom.at/
My blog: soaked and soaped http://soakedandsoaped.com/

Offline

 

#2 2006-09-05 22:35:33

adamp
Coach Class
Registered: 2006-06-20
Posts: 73

Re: HOWTO: Exception Notifier - Ruby on Rails plugin

Handy post, I'll be looking into this soon.

Offline

 

#3 2007-01-15 18:10:12

misiek
Ticketholder
From: Chicago
Registered: 2006-11-17
Posts: 5
Website

Re: HOWTO: Exception Notifier - Ruby on Rails plugin

It totaly does not work !

Offline

 

#4 2007-01-15 20:50:48

Dieter Komendera
First Class
From: Zistersdorf, Austria
Registered: 2006-08-10
Posts: 104
Website

Re: HOWTO: Exception Notifier - Ruby on Rails plugin

What's exactly your problem? May be we can help you to get it work.


My homepage: http://www.komendera.com/
Working at: http://www.abloom.at/
My blog: soaked and soaped http://soakedandsoaped.com/

Offline

 

#5 2007-01-20 16:01:21

Micah
Passenger
From: Atlanta, GA, USA
Registered: 2007-01-16
Posts: 40
Website

Re: HOWTO: Exception Notifier - Ruby on Rails plugin

I'm a Rails newb, so I don't know what I'm talking about, but...

It only seems to work if you are running your server on a non-local machine.  It has something to do with the rescue_action_in_public method.  I think you can override the rescue_action method to call the rescue_action_in_public method, at which point it will send the emails.  However, I don't think this is what you want, as it stops displaying all the debug info on the screen when an exception occurs.


If there is a post/website/blog entry/whatever that answers my questions, please don't hesitate to simply post a link.  I know it can get old fast to answer the same question hundreds of times...

Offline

 

#6 2007-07-09 12:38:19

fannar
Ticketholder
Registered: 2007-07-09
Posts: 6

Re: HOWTO: Exception Notifier - Ruby on Rails plugin

Hi.

I have installed the plugin. I have also included this in my Application Controller:

Code :   - fold - unfold
  1. include ExceptionNotifiable
  2. local_addresses.clear
But no email is sent. My email settings are right, because I'm sending emails when user register.

Any ideas what could be wrong ?

Offline

 

#7 2007-10-21 20:24:19

professionalnerd
Coach Class
From: London
Registered: 2007-03-12
Posts: 83
Website

Re: HOWTO: Exception Notifier - Ruby on Rails plugin

Another thing to mention for anyone who tries this (and like me didn't read the complete readme first!), this won't mail you on RecordNotFound or UnknownAction exceptions.

So while those might be the simplest exceptions to raise on purpose, you'll have to get more creative when it comes to testing it!

Another thing worth mentioning is that it also handily produces 404s for both of these too.


I can't stop thinking about Rails. Can't sleep, can't eat, can't concentrate on work. It must be love.

Offline

 

#8 2008-02-22 23:04:17

maseca
Ticketholder
Registered: 2007-03-29
Posts: 3

Re: HOWTO: Exception Notifier - Ruby on Rails plugin

I also had to set this option in config/environments/development.rb:

config.action_controller.consider_all_requests_local = false

Offline

 
  • Index
  •  » Tutorials
  •  » HOWTO: Exception Notifier - Ruby on Rails plugin

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson