samedi 30 mai 2015

Logging not showing in console during django tests

I am trying some simple tests in django. I have setup my django logging system in my settings file. But when I run my test it won't print debug messages on my console. This happens when I run tests from manage.py test command. If I use my IDE's run command It prints the messages normally. My logging setup is the following

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'
        }
    }
}

Logging is based on django's website example. How can I make messages appear in the console when I run tests with manage.py?

Aucun commentaire:

Enregistrer un commentaire