4

I've tried changing the logging on Savon when running it against a WSDL, but have been unsuccessful in changing the logging level.

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

I did 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 it complains about not knowing what configure means.. any ideas?

nictrix
  • 1,483
  • 1
  • 17
  • 34

2 Answers2

4

At least as of gem 'savon', '~> 2.3.0', you can add the configuration keys when instantiating the client.

client = Savon.client(
    log_level: :debug,
    log: true,
    pretty_print_xml: true,
    wsdl: 'http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx?wsdl'
)
Jonathan Mui
  • 2,471
  • 3
  • 19
  • 27
4

This documentation you linked is for savon 0.8, you may be using an older version. When in doubt, go to the source code (path is platform-dependent) and check how the code/test do 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
...
tokland
  • 66,169
  • 13
  • 144
  • 170
  • thanks! for being a newbie at ruby I still don't know easy little tricks like this.. – nictrix Nov 19 '10 at 00:25
  • 4
    the documentation mentioned by @Nick is not out-dated. it's the new documentation for savon 0.8. but thanks for helping out @tokland – rubiii Feb 14 '11 at 01:54
  • 1
    @rubii. You are right, sorry, I didn't check correctly. BTW, great stuff in 0.8.x, thanks for your work! – tokland Feb 14 '11 at 09:02