Search code examples
pythonloggingcherrypy

Prevent cherrypy from logging access


I'm trying to set up a logger to only catch my ERROR level messages, but my logger always seems to write INFO:cherrypy.access messages to my log file, which I dont want. I tried setting the log.error_file global, and using the standard python logging module logging.basicConfig(filename='error.log', filemode='w', level=logging.ERROR), but even though I specify the threshold to be ERROR level messages, I still get those INFO level messages written to my log file. Is there any way to prevent this?


Solution

  • I can disable access messages by setting up my own:

    logging.basicConfig(filename='error.log', filemode='w', level=logging.ERROR)

    and then setting:

    cherrypy.log.access_log.propagate = False