[issue20345] Better logging defaults

Arne Babenhauserheide report at bugs.python.org
Thu Jan 23 08:37:40 CET 2014


Arne Babenhauserheide added the comment:

I do not think it is necessary to change the defaults, but I do think that it would help users of python.

In the usecase of bigger applications, the default logging format does not matter: the overhead of logging.basicConfig() only happens once while the advantages help for the whole time.

In the usecase of small programs and quick scripts, the overhead of having to use logging.basicConfig() is big, though: It requires reading up on the different formatting options and actually thinking about a good format. But the results only help that small script, and for the next script the programmer will likely have to read the documentation again. If logging would have a better default, the programmer would just have to remember “import logging, then call logging.LEVEL()”. In the python console, logging.<tab> will autocomplete the level, so programmers do not actually have to read up anything: It actually goes down to “log with logging”. And that’s a very different level of usability than having to call logging.basicConfig().

And I think that the filename and the line number is the minimum information necessary for any debug message - though the format could be matched to `grep -n` by replacing the double colon with a single colon.

To stay with your analogy: It’s not about the color of the bikeshed. It’s about providing the basic bycycle stands in the shed, so people who have no strong feelings about bikesheds can simply go there, leave the bike and move on - instead of having to adjust the stand every time to keep their bike from falling over.

I agree, though, that backwards compatibility could be an issue. Can you give me a hint, how I could investigate that?

----------
status: pending -> open

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20345>
_______________________________________


More information about the Python-bugs-list mailing list