Logging errors with Rails logger

Coming from the java log4j world, the default logging functionality in
rails seems a bit primitive to me, but it might have to do with my
lack of knowledge on the subject. Currently I would log an exception
like:

 begin
   //some code
 rescue Net::IMAP::ResponseError => exc
   Rails.logger.error("IMAP error for event #{@event.inspect}:\n

#{exc.message}\n#{exc.backtrace.join("\n")}")
end

The above code gets the job done in that i get a decently formated
backtrace with an error message, but it is obviously not ideal. Also,
my log file is missing valuable meta-data like time and the class
which logged the message. Is there something I am missing?

thx.

-karl

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs