Forums

Unable to apply formatting in logs

Hi, I have the following config in my settings.py - but the formatter is not being applied:

LOGGING = { 
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(filename)s %(lineno)d %(message)s'
        },  
    },  
    'filters': {
        'require_debug_true': {
            '()': 'django.utils.log.RequireDebugTrue',
        },  
    },  
    'handlers': {
        'console': {
            'level': 'INFO',
            'filters': ['require_debug_true'],
            'class': 'logging.StreamHandler',
            'formatter': 'verbose'
        },  
    },  
    'loggers': {
        'main_logger': {
            'handlers': ['console'],
            'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
            'propagate': True
        }   
    }                                                                                                                                               
}

[edit by admin: formatting]

What logging function are you calling to use that configuration?