How to use Django logging with gunicorn

后端 未结 3 2059
生来不讨喜
生来不讨喜 2021-02-08 10:10

I have a Django 1.6 site running with gunicorn, managed by supervisor. During tests and runserver I have logging on the console, but with gunicorn the statements don\'t show up

3条回答
  •  旧时难觅i
    2021-02-08 10:26

    First, in your supervisor config for the gunicorn script, be sure to define

    stdout_logfile=/path/to/logfile.log
    redirect_stderr=true
    

    That will make stdout and stderr go to the same file.
    Now, on your gunicorn script, be sure to call the process with the following argument

    gunicorn YourWSGIModule:app --log-level=critical
    

提交回复
热议问题