我想要关闭CherryPy的HTTP请求日志记录。我已经尝试了:
cherrypy.log.access_file = None
根据我的理解,应该使用这个方法来移除访问日志的处理程序,但是我似乎无法使它起作用。
logging
模块后,告诉CherryPy停止记录日志实际上不起作用。解决方法是这样做:cherrypy.log.error_log.propagate = False
cherrypy.log.access_log.propagate = False
这是我通常的做法:
access_log = cherrypy.log.access_log
for handler in tuple(access_log.handlers):
access_log.removeHandler(handler)
最新版本的CherryPy文档页面docs page中提到,将处理程序设置为""
而不是None
# Remove the default FileHandlers if present.
log.error_file = ""
log.access_file = ""