467,888 Members | 1,373 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,888 developers. It's quick & easy.

dynamically getting loggers

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.

thanks,

bryan

Aug 14 '08 #1
  • viewed: 4451
Share:
1 Reply
En Thu, 14 Aug 2008 18:29:41 -0300, belred <be****@gmail.comescribi�:
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

Aug 15 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Sibyl | last post: by
3 posts views Thread by Jeff Shannon | last post: by
20 posts views Thread by David | last post: by
2 posts views Thread by jonfroehlich | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.