Flask app logger not working when running within gunicorn

后端 未结 5 1141
臣服心动
臣服心动 2021-01-31 17:53

I\'m trying to save application log messages from a very simple flask app in a log file. While this works flawlessly when I\'m running the app with the embedded Flask server, it

5条回答
  •  猫巷女王i
    2021-01-31 18:11

    Someone can search: how to see errors with Python error stack when using Flask with Gunicorn.

    Just set up the flag --error-logfile to the file path where you want to see error stacks. Particularly (when using in Docker) you can set it up in GUNICORN_CMD_ARGS environment variable to the next value (an example):

    --bind=0.0.0.0:8000 --access-logfile=/logs/rest.app/access.log --error-logfile=/logs/rest.app/error.log --capture-output --enable-stdio-inheritance

提交回复
热议问题