Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

logging - Changing root logger level in submodule python

How can I change root logger level in it's submodule

#main.py
logging.basicConfig(filename=filename,format='%(asctime)s %(levelname)s %(message)s',filemode='w')
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

After certain event I want to change all the logging to CRITICAL

sub_logger = logging.getLogger('jdm_health')
#submodule.py
if event:
    logger.setLevel(logging.CRITICAL)#root logger

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...