Recently, there was the question of how to disable logging in Python Flask for a specific endpoint (Skip Flask logging for one endpoint?).
This makes sense for examp
I figured it out - you need to override the pre_request hook.
This can be done as follows:
You need to create a config file, e.g. config/gunicorn.py:
def pre_request(worker, req):
if req.path == '/healthcheck':
return
worker.log.debug("%s %s" % (req.method, req.path))
And then use it when you start gunicorn:
gunicorn server:app -c config/gunicorn.py