En Thu, 14 Aug 2008 18:29:41 -0300, belred <[EMAIL PROTECTED]> escribi�:

is there a way to dynamically get all the active loggers?

i currently have code like this in different areas of the program:

import logging
log = logging.getLogger('foo')


i would like to write a function that dynamically get a list of all
the logger names such as 'foo'.  or get a list of the loggers which i
could then get the names.  is this even possible?  i don't see a
logger function that returns loggers.

Loggers are created when requested, and I don't see a documented way to get such list.
If you don't mind using undocumented attributes:

existing_logger_names = logging.getLogger().manager.loggerDict.keys()

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to