Logging in Django on Heroku not appearing

后端 未结 4 2339
借酒劲吻你
借酒劲吻你 2021-02-19 05:22

I have created an app on Heroku and I push my Django app to it.

I monitor the logs using heroku logs --tail to see them in real time.

Then, in my

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-19 05:39

    Your Procfile is probably at fault here:

    If you want to have gunicorn log to stdout you have to use the --logfile=- command line option (you are missing the = !) according to this answer.

    So your entire Procfile should look like this:

    web: gunicorn myapp.wsgi --log-file=-

    EDIT:

    Since print statements are working for you, but logging is not, your logging setup is probably at fault. Make sure that you set up logging during the startup of your app (where are you calling dictConfig in your code?):

    import logging
    logging.config.dictConfig(LOGGING)
    logger = logging.getLogger('MYAPP')
    logger.info("Just testing")
    

提交回复
热议问题