New submission from Sebastian <seb.scha...@gmail.com>:

In Python 3.6.3 I can do:

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

And it outputs:

INFO:root:PARTY
INFO:root:this works


The line 
logging.info("PARTY") 
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 <rep...@bugs.python.org>
<https://bugs.python.org/issue34350>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to