Forums | Admin

Discussion Forums: open-discussion

Start New Thread Start New Thread

 

By: Aslan N
Resetting the STDOUT [ reply ]  
2009-04-09 03:30
I am trying to catch exceptions and send an email to the admin using the exception_notification plugin.

I monkey patched start_load in class Application:
# TODO: begin - rescue - end around this and exception logging
begin
load script()
rescue ::Exception => e
begin; STDOUT.reopen "/dev/null"; rescue ::Exception; end
STDOUT.sync = true
begin; STDERR.reopen STDOUT; rescue ::Exception; end
STDERR.sync = true
ExceptionNotifier.rescue_model_exception(e)
end

The problem is i get an error
vendor/rails/activesupport/lib/active_support/buffered_logger.rb:98:in `write': closed stream (IOError)
This is when the action mailer tries to send the mail and put stuff in its logger file.

Can anyone help?