当我使用logging.getLogger(__name__)
创建一个子记录器时,它是否具有默认的日志处理程序,日志级别,日志格式?
答案 0 :(得分:0)
log = logging.getLogger(__name__)
print(log.__dict__) # this gives attributes dictionary
输出:
{'filters': [], 'name': '__main__', 'level': 0, 'parent': <RootLogger root (WARNING)>, 'propagate': True, 'handlers': [], 'disabled': False, '_cache': {}, 'manager': <logging.Manager object at 0x000001ECCF434520>}
print('value of level attribute (i.e. log level) is: ',log.__getattribute__('level')) # this gives value of individual attributes
输出:
value of level attribute (i.e. log level) is: 0
这里的日志级别0
代表NOTSET