开始时设置成了logging.DEBUG,后来改为了logging.INFO,感觉还是在以DEBUG的等级打印日志
import logging
logging.basicConfig(level=logging.DEBUG)
logging.debug('1.This is debug message')
logging.info('2.This is info message')
logging.warning('3.This is warning message')
logging.basicConfig(level=logging.INFO)
logging.debug('4.This is debug message')
logging.info('5.This is info message')
logging.warning('6.This is warning message')
log如下:
DEBUG:root:1.This is debug message
INFO:root:2.This is info message
WARNING:root:3.This is warning message
DEBUG:root:4.This is debug message
INFO:root:5.This is info message
WARNING:root:6.This is warning message
第二次
basicConfig
调用不产生任何影响。官方文档: https://docs.python.org/2/library/logging.html#logging.basicConfig