Is there a way to log python print statements in gunicorn?

前端 未结 4 1226
伪装坚强ぢ
伪装坚强ぢ 2021-02-03 18:58

With my Procfile like this:

web: gunicorn app:app \\
    --bind \"$HOST:$PORT\" \\
    --debug --error-logfile \"-\" \\
    --enable-stdio-inheritance \\
    --r         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-03 19:25

    Please try below command:

    gunicorn --workers 3 --bind 127.0.0.1:5000 --error-logfile /var/log/gunicorn/error.log --access-logfile /var/log/gunicorn/access.log --capture-output --log-level debug
    

    It did work for me.

    Please specify log-level to debug(default info)http://docs.gunicorn.org/en/stable/settings.html#loglevel,

    Also, specify capture-output flag (default false)http://docs.gunicorn.org/en/stable/settings.html#capture-output.

    You should be able to watch logs in error log file.

提交回复
热议问题