logging.info doesn't show up on console but warn and error do

前端 未结 3 1759
慢半拍i
慢半拍i 2021-01-30 19:29

When I log an event with logging.info, it doesn\'t appear in the Python terminal.

import logging
logging.info(\'I am info\')  # no output

3条回答
  •  情歌与酒
    2021-01-30 19:55

    The root logger always defaults to WARNING level. Try calling

    logging.getLogger().setLevel(logging.INFO)
    

    and you should be fine.

提交回复
热议问题