[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

handling errors via mail

Radu Spineanu

9/16/2006 11:01:00 PM

Hi

I have a small script that runs daemonized and does some basic SQL
operations.

I was wondering if it possible that in case of an exception the program
could send an email with the exception, and at the same time log it in
a file.

I looked over log4r, however I couldn't get it to log exceptions.

Thanks,
Radu Spineanu

1 Answer

Radu Spineanu

9/16/2006 11:15:00 PM

0

Radu Spineanu wrote:
> I was wondering if it possible that in case of an exception the program
> could send an email with the exception, and at the same time log it in
> a file.
>

Never mind...

begin
loop do
# stuff
sleep 15
end
rescue Exception => rescueError
if (rescueError)
log.fatal rescueError.message
log.fatal rescueError.backtrace.inspect
log.fatal '---------------------------------'
end
end

Radu Spineanu