Papertrail logs not displaying for Django app in production

30 Views Asked by At

I have a Django app that is deployed to production using Heroku. I am currently trying to integrate papertrail logging but no logs are being sent to production. At this point I am at a total loss as to why my logs are not going through. I am not using papertrail as a Heroku addon, but am using the web interface.

This is what my LOGGING setting is in settings.py

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'verbose': {
            'format': '{levelname} {asctime} {module} {message}',
            'style': '{',
        },
    },
    'handlers': {
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'verbose',
        },
        'papertrail': {
            'level': 'INFO',
            'class': 'logging.handlers.SysLogHandler',
            'address': ('logsX.papertrailapp.com', XXXXX),
            'formatter': 'verbose',
        },
    },
    'loggers': {
        '': {  # This is the root logger, capturing logs from any logger.
            'handlers': ['console', 'papertrail'],  # Start with 'console' for development. Add 'papertrail' for production.
            'level': 'DEBUG',
            'propagate': True,
        },
    },
}

NOTE: In my code the address is correct, I am of course redacting it in this post.

In my views.py I have the following code:

import logging

logger = logging.getLogger(__name__)

def index(request):
    logger.warning('test')

I have deployed this to production but I see no logs coming in. I am at a loss as to what could be wrong, any ideas?

0

There are 0 best solutions below