selenium+python
. python 的logging日志模块配合配置文件使用
通过selenium+python过程中经常需要记录程序运行过程中的异常和操作记录、程序问题、定位问题等;
给大家分享下,通过python中的logging模块以配置文件进行日志配置使用;
1、创建配置文件:logger.conf
# logger.conf
####################################
[loggers] #配置logger信息。
keys = root,example01,example02 #必须包含一个名字叫做root的logger,其他可以自定义
[logger_root] #按照固定格式:logger_(logersname)定义一些规则
level = DEBUG #设置日志等级
handlers = hand01,hand02 #设置指定过滤器,多个以逗号分隔,后面设置handlers以固定格式用到
[logger_example01]
handlers = hand01,hand02
qualname = example01 #除root不需要设置外,其他自定义的都需要设置该属性,定义打印输出时候对应信息
propagate = 0
[logger_example02]
handlers = hand01,hand03
qualname = example02
propagate = 0
##############