Handling errors via mail

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

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