Logging not showing in console during django tests

I am trying to do some simple tests in django. I installed my django registration system in my settings file. But when I run my test, it will not print debugging messages on my console. This happens when I run tests from the manage.py test command. If I use the IDE start command, it prints messages normally. My registration setting is as follows

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(process)d (thread)d %(message)s'
        },
        'simple':{
            'format': '%(levelname)s %(message)s'
        },
    },
    'handlers': {
        'null': {
            'level': 'DEBUG',
            'class': 'django.utils.log.NullHandler',
        },
        'console': {
            'level':'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'simple',
        },
    },
    'loggers': {
        'django': {
            'handlers': ['console', ],
            'propagate': True,
            'level': 'DEBUG'

        },
        'payments_system': {
            'handlers': ['console', ],
            'propagate': True,
            'level': 'DEBUG'
        }
    }
}

The magazine is based on the example of the django site. How can I make messages appear in the console when I run tests using manage.py?

+4
source share
1 answer

I have a Django entry configured to enter a file, for example:

'handlers': {
    'file': {
        'level': 'DEBUG',
        'class': 'logging.FileHandler',
        'filename': '/path/to/django/debug.log',
    },
},

python manage.py test, .

console, stdout, , , . FileHandler. . .

0

All Articles