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 |