5

how to enable logging when I`m running tests in django? My goal is to save all errors to file. Here is my config:

LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
    'file': {
        'level': 'DEBUG',
        'class': 'logging.FileHandler',
        'filename': os.path.join(BASE_DIR, 'file.log'),
    },
},
'loggers': {
    'django.request': {
        'handlers': ['file'],
        'level': 'DEBUG',
        'propagate': True,
    },
    'apps.hello': {
        'handlers': ['file'],
        'level': 'DEBUG',
        'propagate': True,
    },
},
}

This config works good when runserver but when im trying to run tests it save nothing.

Also I tried some hacks before i asked question. One Two

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.