Question on PEP 337

Vinay Sajip vinay_sajip at yahoo.co.uk
Wed Oct 28 18:16:50 EDT 2009


Gabor Urban <urbangabo <at> gmail.com> writes:

> 
> Hy guys,
> 
> this PEP is very well written, and I have found the discussion inspiring.
> 
> Every time I use the logging module, I have the configuration hardcoded in
> the application. That is why I never used the configuration file based
> approach. Now I will give it a try.....
> 
> I think we should discuss the following scenario (it was not clear in the
> PEP for me) : an application has the logging configuration in a config file
> and it is  currently running. The user edits this file, so the configuiration
> in the running process should be changed.

You would have to do this "by hand": watch for file changes, reload the file
into a dict, call logging.config.dictConfig with the new dict.

PEP 391 is basically about using a dict to configure logging, but doesn't say
where the dict comes from - it could be from deserializing a YAML or JSON file
or importing a Python source file, or it could be received as a pickle over the
wire and unpickled ... the logging package only knows about the dict and this
must follow the schema described in the PEP.

Regards,

Vinay Sajip





More information about the Python-list mailing list