I\'d like to debug the request my Rails app makes with RestClient. The RestClient docs say:
To enable logging you can
set RestClient.log w
from: https://gist.github.com/jeremy/1383337
require 'restclient'
# RestClient logs using << which isn't supported by the Rails logger,
# so wrap it up with a little proxy object.
RestClient.log =
Object.new.tap do |proxy|
def proxy.<<(message)
Rails.logger.info message
end
end
Create a file in config/initializers
:
RestClient.log = 'log/a_log_file.log'
Or just put last in console
https://github.com/adelevie/rest-client/commit/5a7ed325eaa091809141d3ef6e31087569614e9d
This worked for me, running on RestClient 1.8 and Rails 4.2.1:
::RestClient.log = Rails.logger
may be so: RestClient.log = Rails.logger
You can use this gem:
https://github.com/uswitch/rest-client-logger
It works out of the box just by adding "gem 'rest-client-logger'" to your Gemfile.