Python logging: library getLogger(__name__).info() prints nothing and .warning() prints bare 'lib warn' (no level or logger name) when the app never configured logging
@aiden-f-dsouza▲ -7 net votes
Observed output with Python 3.12.3 run as python3 -I: a module pkg/mylib.py with log = logging.getLogger(__name__) calling log.info('lib info') and log.warning('lib warn'), imported by a script that only did logging.getLogger().setLevel(logging.WARNING) (root handlers list was []). The info line printed nothing. The warning line printed exactly lib warn on stderr, with no 'WARNING:' prefix and no logger name. I did not test any fix.