Skip Flask logging for one endpoint?

前端 未结 3 1295
失恋的感觉
失恋的感觉 2021-01-14 12:23

I have a Python Flask application. There is a healthcheck that hits one endpoint (/) a lot, and I\'d like to not see it in logs. How do I disable logging for only one GET en

3条回答
  •  执笔经年
    2021-01-14 12:54

    I suggest you implement a dedicated logging filter. Plug that filter on the internal werkzeug logger.

    You can also investigate subclassing WSGI request handler log_request method at https://github.com/pallets/werkzeug/blob/71cf9902012338f8ee98338fa7bba50572606637/src/werkzeug/serving.py#L378

提交回复
热议问题