handling errors via mail

R

Radu Spineanu

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
 
R

Radu Spineanu

Radu said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,212
Messages
2,571,101
Members
47,695
Latest member
KayleneBee

Latest Threads

Top