[英]Python Cherrypy: Disable logging of requests
I'm trying to silence the logging of http requests from CherryPy. 我正试图使来自CherryPy的http请求的记录无声。 I've tried 我试过了
cherrypy.log.access_file = None
which as I understand it should remove the handler for access logging, but I can't seem to get it to work. 根据我的理解,它应该删除访问日志记录的处理程序,但我似乎无法让它工作。
Apparently, telling CherryPy to stop logging doesn't actually do anything when you've independently configured Python's logging
module. 显然,当你独立配置Python的logging
模块时,告诉CherryPy停止记录实际上并没有做任何事情。 The solution is to do this: 解决方案是这样做:
cherrypy.log.error_log.propagate = False
cherrypy.log.access_log.propagate = False
(Hat tip to this blog post , which is unfortunately now down.) (帽子提示这个博客文章 ,不幸的是现在已经失败了。)
This is how I normally do: 这就是我通常做的事情:
access_log = cherrypy.log.access_log
for handler in tuple(access_log.handlers):
access_log.removeHandler(handler)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.