[issue34107] root.warning('msg') output format modified by logging.warning('msg')

Michael Kearney report at bugs.python.org
Thu Jul 12 20:25:05 EDT 2018


New submission from Michael Kearney <dsmakearney at gmail.com>:

0 >>> import logging
1 >>> root=logging.getLogger(name='root')
2 >>> root.warning('msg')
3 msg                                   <----- Compare this line
4 >>> logging.warning('msg')
5 WARNING:root:msg
6 >>> root.warning('msg')
7 WARNING:root:msg                      <------ with this line

Specifically, I was surprised to see
   line 7 response to line 6
given
   line 3 response to line 2

logger methods log(),critical(),error(),info() act the same way.

A workaround from issue 33897 fixes things
   logging.basicConfig(level=logging.DEBUG, force=True)

I discovered this when exploring "logging" module defaults, It is the sort of thing someone new to the module might encounter. I did.

Slightly more comprehensive unittest example attached.

This may be my first real submission. Feedback appreciated

----------
files: logTest.py
messages: 321582
nosy: Michael Kearney
priority: normal
severity: normal
status: open
title: root.warning('msg') output format  modified by logging.warning('msg')
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file47686/logTest.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34107>
_______________________________________


More information about the Python-bugs-list mailing list