Ruby Savon Gem Change Record Configuration

I tried to change the logging in Savon when I ran it against WSDL, but I could not change the logging level.

I read the docs: http://rubiii.github.com/savon/#global_configuration

I have done this:

Savon.configure do |config|
  config.log = false            # disable logging
  config.log_level = :info      # changing the log level
  config.logger = Rails.logger  # using the Rails logger
end

And he complains that he doesn't know what configure means .. any ideas?

+2
source share
2 answers

In this documentation you pointed out for savon 0.8, you can use an older version. If in doubt, go to the source code (the path depends on the platform) and check how the code / test does it:

$ cd /usr/lib/ruby/gems/1.8/gems/savon-0.7.8
$ grep -lr log_level * 
lib/savon/logger.rb
spec/savon/request_spec.rb
$ cat spec/savon/request_spec.rb
...
Savon::Request.log_level = :info
...
+4
source

At least since gem 'savon', '~> 2.3.0', you can add configuration keys when creating a client instance.

client = Savon.client(
    log_level: :debug,
    log: true,
    pretty_print_xml: true,
    wsdl: 'http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx?wsdl'
)
+1

All Articles