Enumerating loggers iin logging module

jptechnical.co.uk johnpote at jptechnical.co.uk
Tue Dec 30 13:42:29 EST 2014


Hello all,
I've recently started using the logging module and wondered if there was 
a way to enumerate all the Logger objects available as a result of calls 
to "logging.getLogger(name)". Went through the docs and could not spot 
any way of doing this. Have I missed something?

It would have been useful to list the Loggers created in an app as I'd 
made the mistake of writing:
in module A:    logging.getLogger("Name")
in module B:    logging.getLogger("name.sublogger")

and wondered why messages sent to "name.sublogger" did not get passed to 
the parent handler in "Name". A list of of available loggers would have 
quickly shown the error of my ways.

I'm using Python 2.7.8

Any help appreciated,
Regards
John



More information about the Python-list mailing list