Disable console messages in Flask server

前端 未结 10 833
旧巷少年郎
旧巷少年郎 2020-11-28 07:42

I have a Flask server running in standalone mode (using app.run()). But, I don\'t want any messages in the console, like

127.0.0.1 - - [15/Feb/2         


        
10条回答
  •  星月不相逢
    2020-11-28 08:30

    A brute force way to do it if you really don't want anything to log into the console beside print() statements is to logging.basicConfig(level=logging.FATAL). This would disable all logs that are of status under fatal. It would not disable printing but yeah, just a thought :/

    EDIT: I realized it would be selfish of me not to put a link to the documentation I used :) https://docs.python.org/3/howto/logging.html#logging-basic-tutorial

提交回复
热议问题