On May 18, 11:10 pm, Ian Kelly <ian.g.ke...@gmail.com> wrote: > It seems to work without any configuration just as well as the root logger: > > >>> importlogging > >>>logging.getLogger('foo').warning('test') > > WARNING:foo:test > > Or am I misunderstanding you?
In general for Python 2.x, the code import logging logging.getLogger('foo').warning('test') will produce No handlers could be found for logger "foo" unless loggers have been configured, e.g. by calling logging.warning() - that call implicitly adds a console handler to the root logger, if no other handlers have been configured for the root logger. In Python 3.2 and later, if no handlers have been configured, messages at level WARNING and greater will be printed to sys.stderr using a "handler of last resort" - see http://docs.python.org/py3k/howto/logging.html#what-happens-if-no-configuration-is-provided Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list