[英]What is the default setting (log handler, log level, log format) for child logger?
當我使用logging.getLogger(__name__)
創建子記錄器時,它是否具有默認的日志處理程序、日志級別、日志格式?
log = logging.getLogger(__name__)
print(log.__dict__) # this gives attributes dictionary
Output:
{'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
Output:
value of level attribute (ie log level) is: 0
這里日志級別0
代表NOTSET
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.