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

daydreamer picture daydreamer · Jul 18, 2012 · Viewed 76.9k times · Source

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

In contrast, events logged with logging.warn do appear in the terminal.

import logging
logging.warn('I am warning')  # outputs "I am warning"

Is there a environment level change I can to make logging.info print to the console? I want to avoid making changes in each Python file.

Answer

Ztyx picture Ztyx · Jul 18, 2012

The root logger always defaults to WARNING level. Try calling

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

and you should be fine.