On 16 May 2014 21:34, M.-A. Lemburg
On 16.05.2014 11:54, Antoine Pitrou wrote:
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.
Hmm, it's a fairly standard way to define config file locations esp. on Unix platforms, so I don't follow you here. Perhaps I'm just missing some context.
Such env vars are often used in application environments to override system defaults, e.g. for finding OpenSSL or ODBC config files.
Python is a language runtime, not an application. Having globally configurable behaviours for a runtime is, in general, questionable, which is why we have the options to ignore the environment variables, site-packages, user site-packages and now the "isolated mode" flag that basically says "ignore *every* explicitly configurable Python setting in the environment". For 3.2+, we defined a sensible default logging configuration (warning and above written to stderr, everything else ignored), so users should be free to just use the logging module when writing libraries without worrying about whether or not it has been configured for reporting properly. That doesn't help Python 2 users, but that's the case for a lot of things. Trying to provide a way to actually *configure* logging in a general way would be fraught with backwards compatibility issues when it came to interfering with frameworks (whether for writing CLI applications, web applications, or GUI applications) that already providing their own way of handling logging configuration. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia