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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With