[Python-ideas] logging.config.defaultConfig()

Antoine Pitrou solipsis at pitrou.net
Fri May 16 11:54:17 CEST 2014


On Fri, 16 May 2014 11:32:55 +0200
Jonas Wielicki <j.wielicki at sotecware.net>
wrote:
> On 16.05.2014 11:27, Antoine Pitrou wrote:
> > On Fri, 16 May 2014 09:05:11 +0200
> > Thomas Güttler
> > <guettli at thomas-guettler.de> wrote:
> >>
> >> I think the following solution is very flexible and solves most needs to set up logging,
> >> since I can implement your needs in for example your_environment_module.set_up()
> > 
> > This looks dubious to me. There is no reason to have a shared Python
> > logging configuration, IMO. Also, I don't understand why this is
> > importing a module.
> 
> While I agree that importing a module might not be the right way, having
> a standard way to configure logging via environment variables might be
> helpful.

I entirely disagree. An environment variable is a very lousy way to
specify a configuration file's location; and there is no reason to have
a common logging configuration for all Python applications.

> Configuring logging is a difficult thing if done fully, like, allowing
> different loglevels for different loggers. Having this implemented in
> the standard library might be actually useful (and it’s also done that
> way in other languages).

What does this have to do with environment variables?
logging.dictConfig() already does this.

Regards

Antoine.




More information about the Python-ideas mailing list