I am working on rails project and I am trying to get exceptions to be logged to the rails log files. I know I can call logger.error $! to get the first line of the exception logged to the file. But, I want to get the entire trace stack logged as well. How do I log the entire trace back of an exception using the default rails logger?
logger.error $!
logger.error $!.backtrace
Also, don't forget you can
rescue ErrorType => error_name
to give your error a variable name other than the default $!.
$!
1.4m articles
1.4m replys
5 comments
57.0k users