本文介绍了Ruby Savon Gem 更改日志记录配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在针对 WSDL 运行 Savon 时,我尝试更改它的日志记录,但更改日志记录级别没有成功.

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

我阅读了文档:http://rubiii.github.com/savon/#global_configuration

我这样做了:

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?

推荐答案

您链接的此文档适用于 savon 0.8,您可能使用的是旧版本.如有疑问,请转到源代码(路径取决于平台)并检查代码/测试如何执行:

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
...

这篇关于Ruby Savon Gem 更改日志记录配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!