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?
Ruby-on-rails – How to log the entire trace back of a Ruby exception using the default Rails logger
loggingrubyruby-on-rails
Related Question
- Ruby – How to make –no-ri –no-rdoc the default for gem install
- Ruby-on-rails – Rails: How to rename a database column in a Ruby on Rails migration
- Ruby-on-rails – How to get the current absolute URL in Ruby on Rails
- Ruby-on-rails – How to drop columns using Rails migration
- Ruby-on-rails – Rails: Logging the entire stack trace of an exception
- Ruby – Get current stack trace in Ruby without raising an exception
- Using logger in Rails 4
Best Solution
Also, don't forget you can
to give your error a variable name other than the default
$!
.