How to turn off django logging INFO to console?

Viewed 186

For some reason I cannot figure out how to get django to stop spamming INFO level information to the console. I've tried logging.disable(logging.CRITICAL) in settings.py, as well as this dict in settings.py:

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
        },
    },
    'root': {
        'handlers': ['console'],
        'level': 'INFO',
        'propagate': False
    },
}

Can anyone help me with this? Thanks!

1 Answers

Django also provide a way to redirect logging messages in a file. I advise you to use a temp file or a file you clean each time you stop development.

The Django documentation example

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
    'file': {
        'level': 'DEBUG',
        'class': 'logging.FileHandler',
        'filename': '/path/to/django/debug.log',
    },
},
'loggers': {
    'django': {
        'handlers': ['file'],
        'level': 'DEBUG',
        'propagate': True,
    },
},

}

Related