Exception Notifier plugin
From WhyNotWiki
Answers: "How do I set it up to e-mail me when an error message occurs?"
What, you mean you aren't at the terminal tailing production.log at all hours of the day and night in case an important error should occur?? Shame on you.
Read Global Error Handling with Exception Notification
... which will tell you to
./script/plugin install exception_notification
From Readme:
= Exception Notifier Plugin for Rails The Exception Notifier plugin provides a mailer object and a default set of templates for sending email notifications when errors occur in a Rails application. The plugin is configurable, allowing programmers to specify: * the sender address of the email * the recipient addresses * the text used to prefix the subject line The email includes information about the current request, session, and environment, and also gives a backtrace of the exception.
This plug-in makes the following (default) assumption: you only want to send the exception details via e-mail if the exception details are not printed to the screen.
More verbosely:
- For local requests, you don't want to send an e-mail
- For non-local requests, you want to send an exception notification e-mail with the details of the exception
I have a hard time deciding whether I would also like to be e-mailed of every error that happens during development. That would probably get annoying, so I think I agree with their assumptions. You already see the error on the screen (you've already been 'notified' of the error that way), so why do you need it e-mailed to you as well?
If you do decide you want to get e-mails for errors during development, that is fortunately pretty easy to do too:
- Just override rescue_action_locally (in addition to rescue_action_in_public)! (http://rails.techno-weenie.net/tip/2006/8/31/exception-notification-plugin-fix)
Another way to get it to e-mail you also during development is to override log_error(). Then whenever an error is logged, you also get an e-mail. (Idea from Ruby Cookbook, Chapter 15, Section 20.)
