可以在没有INFO:root的情况下python日志输出 [英] can python log output without INFO:root

查看:62
本文介绍了可以在没有INFO:root的情况下python日志输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用默认设置的Python日志记录框架.对于某些数据比较原因:我必须将日志与其他数据输出进行比较.但是python日志以默认值开头,例如:

I use the Python logging framework with default settings. For some data compare reason:I have to compare the log with other data output. But the python log begin with a default, something like:

INFO:root:post params in transmitter

是否可以在没有 INFO:root:的情况下设置python日志输出,例如:

Can I set the python log output without INFO:root:, like:

post params in transmitter

仅具有我自己的日志?

非常感谢!

推荐答案

当然.您可以将格式设置为您喜欢的水:

Sure thing. You could set the format to watever you like:

format: '%(message)s'

赞:

logging.basicConfig(format='%(message)s', ...)

有关更多信息,请参见文档: http://docs.python.org/library/logging.config.html

See the doc for more info: http://docs.python.org/library/logging.config.html

这篇关于可以在没有INFO:root的情况下python日志输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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