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?

2 Answers 2

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
...
3
  • thanks! for being a newbie at ruby I still don't know easy little tricks like this..
    – nictrix
    Commented Nov 19, 2010 at 0: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
    Commented Feb 14, 2011 at 1:54
  • 1
    @rubii. You are right, sorry, I didn't check correctly. BTW, great stuff in 0.8.x, thanks for your work!
    – tokland
    Commented Feb 14, 2011 at 9:02
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'
)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.