python - 子记录器的默认设置(日志处理程序、日志级别、日志格式)是什么?
问题描述
当我使用创建子记录器logging.getLogger(__name__)
时,它是否具有默认的日志处理程序、日志级别、日志格式?
解决方案
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
推荐阅读
- dynamics-crm - Label positioning in D365 UCI is inconsistent
- c++ - 通过为组合框提供条件将启用更改为禁用内容
- c - 动态分支预测未命中计数 - 不正确
- go - 为什么通过 http.ServeContent 阅读我的视频的客户不断关闭连接?
- sql - PL/SQL 计算来自 pdf blob 的页面
- python - 使用python pandas将csv列内的值替换为同一列括号内的值
- ubuntu - 多线程使用make时出现Cmake问题
- scala - 如何从数据框中根据索引提取数据
- android - 如何创建具有两行和动态项目宽度的水平回收视图
- python - 继承和循环导入的问题