禁用博托记录,而无需修改博托文件 [英] Disable boto logging without modifying the boto files

查看:184
本文介绍了禁用博托记录,而无需修改博托文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在用的是宝途库交谈AWS。我想禁用日志记录。 (或重定向到/ dev / null或其他文件)。我无法找到一个明显的方法来做到这一点。我想这一点,但似乎并没有帮助。

I am using the Boto library to talk to AWS. I want to disable logging. (Or redirect to /dev/null or other file). I cant find an obvious way to do this. I tried this, but that doesn't seem to help.

import boto
boto.set_file_logger('boto', 'logs/boto.log')

本说,这是可能的,<一个href="http://developer.amazonwebservices.com/connect/thread.jspa?messageID=52727&#52727">http://developer.amazonwebservices.com/connect/thread.jspa?messageID=52727&#52727但AFAIK文档犯规告知如何。

This says it is possible, http://developer.amazonwebservices.com/connect/thread.jspa?messageID=52727&#52727 but AFAIK the documentation doesnt tell how.

推荐答案

您可以尝试

import logging
logging.getLogger('boto').setLevel(logging.CRITICAL)

这将坐席preSS错误的所有(除其他关键)。

which will suppress all (other than CRITICAL) errors.

博托使用日志记录配置文件(如 /etc/boto.cfg 〜/ .boto )等等看如果你可以将其配置为您的需求的方式。

Boto uses logging configuration files (e.g. /etc/boto.cfg, ~/.boto) so see if you can configure it to your needs that way.

set_file_logger 通话只是增加了一个用户自定义的文件,日志设置,所以你不能用它来关闭日志记录。

The set_file_logger call simply adds a user-defined file to the logging setup, so you can't use that to turn logging off.

这篇关于禁用博托记录,而无需修改博托文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆