Why Django logging skips log entries?

前端 未结 4 2017
名媛妹妹
名媛妹妹 2020-12-30 23:53

This is my settings module:

LOGGING = {
  \'version\': 1,
  \'disable_existing_loggers\': False,
  \'handlers\': {
    \'file\': {
        \'level\': \'DEBU         


        
4条回答
  •  感情败类
    2020-12-31 00:11

    Your logging configuration only captures logs within the django namespace.

    This line:

    logger = logging.getLogger(__name__)
    

    ... tells the logger to use your module's name as the namespace for these logs (docs). If your module is called mymodule, then you can catch these logs by adding something like this to your logging configuration:

    'loggers': {
       'django' : {...},
       'mymodule': {
            'handlers': ['file'],
            'level': 'DEBUG',
            'propagate': True,
        },
    },
    

提交回复
热议问题