[Python-Dev] A new way to configure logging

Doug Hellmann doug.hellmann at gmail.com
Thu Oct 8 14:21:15 CEST 2009

On Oct 7, 2009, at 10:49 AM, Vinay Sajip wrote:

> All three of the contenders for the title of "commonly found  
> configuration
> mechanism" - JSON, YAML and Python code - will be expressible, in  
> Python, as
> Python dicts. So it seems to make sense to add, to logging.config, a  
> new
> callable bound to "dictConfig" which will take a single dictionary  
> argument and
> configure logging from that dictionary.

I've had bad experiences in the past with dictionary-based APIs.  They  
seem "simpler" in the short run, because the user "only needs to  
create some dictionaries".  Once the complexity of that nested  
dictionary grows to a certain point, though, one has to refer back to  
documentation constantly to make sure the structure conforms to the  
"schema".  Building a simple config tree using light-weight classes  
with documented APIs tends to be more sustainable in the long run.


More information about the Python-Dev mailing list