python logging

Ian Kelly ian.g.kelly at gmail.com
Wed May 18 18:42:07 EDT 2011


2011/5/18 Ian Kelly <ian.g.kelly at gmail.com>:
> Ah, that's it.  I was using Python 2.5.  Using 2.7 I get the same
> result that you do.
>
> Still, it's a surprising change that doesn't seem to be documented as
> such.  I'm not sure whether it's a regression or an intentional
> change.

I was wrong, it's more complicated than that.

Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.getLogger('log').warning('test')
No handlers could be found for logger "log"
>>> logging.warning('test')
WARNING:root:test
>>> logging.getLogger('log').warning('test')
WARNING:log:test

Apparently, getLogger() is unconfigured by default, but if you just
use the root logger once, then they magically get configured.



More information about the Python-list mailing list