What is the best way to add a logger for all the ActiveResource in rails
?
In my application i have some methods which call the API through ActiveResource
which sometimes gives TimeOut error.
So, i just want to log the url
, method(get/post)
and some url related stuff in logger for which it gives the TimeOut or any other Error.
You can define a new logger for ActiveResource by adding this to your
config/environment.rb
:If you just want to log the errors you can use it only for
Logger::Error
:To have a custom exception handling I will recommend to copy the source file of ActiveResource Exception handling to
config/initializers/
and change the file according to your needs. This way you are controlling the behaviour of your exceptions and since there are different type of exceptions you'll be able to customize all of them.