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

前端 未结 4 1227
伪装坚强ぢ
伪装坚强ぢ 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条回答
  •  梦毁少年i
    2021-02-03 19:40

    It turns out the print statements were actually getting through, but with delay.

    The gunicorn docs for --enable-stdio-inheritance note to set the PYTHONUNBUFFERED, which I thought I had, but it seems with wrong syntax.

    I solved it using a .env file with my foreman setup to set the variable like this:

    PYTHONUNBUFFERED=TRUE
    

提交回复
热议问题