[New-bugs-announce] [issue34350] Non obvious logging handler behaviour

Sebastian report at bugs.python.org
Mon Aug 6 16:41:27 EDT 2018

New submission from Sebastian <seb.schaetz at gmail.com>:

In Python 3.6.3 I can do:

import logging
logger = logging.getLogger()
logger.info("this does not work")
logger.info("this works")

And it outputs:

INFO:root:this works

The line 
seems to add a handler which makes the last line work. This is very confusing behavior as it is not obvious that a call to "logging.info" mutates the state of the logging subsystem and affects subsequent logging calls.

components: Library (Lib)
messages: 323224
nosy: oneofthose
priority: normal
severity: normal
status: open
title: Non obvious logging handler behaviour
versions: Python 3.6, Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list