[Python-Dev] A proposal: configuring logging using dictionaries

Vinay Sajip vinay_sajip at yahoo.co.uk
Sun Oct 18 13:50:23 CEST 2009

Nick Coghlan <ncoghlan <at> gmail.com> writes:

> My other question is whether or not it would be worth having the logging
> module able to export it's *current* configuration in dictionary form. I
> don't have a use case other than that it might be useful for debugging
> logging configuration errors when attempting to combine multiple sources
> of logging data, but it's worth considering.

One restriction on any output of the current configuration is that it may not be
suitable for round-tripping, i.e. you may not be able to use the output dict to
(re)configure the system. That's because in general, the configurator wants to
know how to instantiate handlers, filters, formatters and so it essentially
needs the constructor arguments in an incoming dict. However, there's no
requirement for the handlers, filters and formatters to keep those constructor
arguments around in the original form; and so, in the general case, they are not
available to output in a dict describing the current configuration.


Vinay Sajip

More information about the Python-Dev mailing list