3

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

Community
  • 1
  • 1
murdoc
  • 31
  • 2

0 Answers0