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
Your Procfile and LOGGING configuration looks fine. Django configures the logger just before the apps are imported, so if you try to log even before than (for. e.g. from settings.py file), it will not work.
EDIT:
LOGGING config:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': ('%(asctime)s [%(process)d] [%(levelname)s] '
'pathname=%(pathname)s lineno=%(lineno)s '
'funcname=%(funcName)s %(message)s'),
'datefmt': '%Y-%m-%d %H:%M:%S'
},
'simple': {
'format': '%(levelname)s %(message)s'
}
},
'handlers': {
'null': {
'level': 'DEBUG',
'class': 'logging.NullHandler',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
}
},
'loggers': {
'ex_logger': {
'handlers': ['console', ],
'level': 'INFO',
}
}
}
adding following to settings.py won't log:
import logging
logger = logging.getLogger('ex_logger')
logger.info("core.settings logger") # won't work
adding to views.py should log:
from django.http import HttpResponse
import logging
logger = logging.getLogger('ex_logger')
logger.info("core.views logger") # should work
def url_please(request):
logger.info("path: %s" % request.path) # should work
return HttpResponse(request.path)