I'm trying to silence the logging of http requests from CherryPy. 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.
I'm trying to silence the logging of http requests from CherryPy. 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. 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)
It says on the docs page for the latest version of CherryPy to set the handler to ""
not to None
# Remove the default FileHandlers if present.
log.error_file = ""
log.access_file = ""
© 2022 - 2024 — McMap. All rights reserved.