I have a Django application deployed on Heroku.
I am using the default logging module, and my logs show normally in development, both when DEBUG
is True and False.
Though, I am unable to see the logs when deployed to heroku with the command heroku logs --tail
.
Here is the content of my settings.py
file:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'simple': {
'format': '{levelname} [{asctime}] module:{module} - {message}',
'style': '{',
},
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'simple',
'stream': sys.stdout,
},
},
'loggers': { # I tried replacing this with 'root'
'': {
'handlers': ['console'],
'level': 'DEBUG',
},
}
}
In my files such as views.py
:
import logging
logger = logging.getLogger(__name__)
logging.debug('something...')
And finally, in my Procfile
:
release: python manage.py migrate --settings=myapp.deploy_settings
web: gunicorn myapp.wsgi --log-file -
I also tried with web: gunicorn myapp.wsgi --log-file=-
as mentioned in a StackOverflow post, without success.
What is causing this?
question from:
https://stackoverflow.com/questions/65851349/django-application-logs-not-showing-in-heroku 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…