Proposed changes to logging defaults
Jean-Michel Pichavant
jeanmichel at sequans.com
Fri Dec 10 05:17:33 EST 2010
Vinay Sajip wrote:
> Some changes are being proposed to how logging works in default
> configurations.
>
> Briefly - when a logging event occurs which needs to be output to some
> log, the behaviour of the logging package when no explicit logging
> configuration is provided will change, most likely to log those events
> to sys.stderr with a default format.
>
> Since this proposed change to behaviour is backwards-incompatible (and
> scheduled to come in to Python 3.2 - earlier Pythons, including 2.X,
> are unaffected), you may be interested in seeing if the changes affect
> you. More details are available here:
>
> http://plumberjack.blogspot.com/2010/12/proposed-changes-to-logging-defaults.html
>
> Please feel free to add comments to the linked blog post.
>
> Regards,
>
> Vinay Sajip
>
Why would you log informative messages to stderr ? (debug, info, warning)
How stderr is a better choice than stdout ?
A naive approach would rather send errors to stderr & everything else on
stdout (including warnings ?).
IMO, the StreamHandler(sys.stderr) level should be set to logging.ERROR
by default. Because nobody can answer the question 'is a warning an
error', endless debate, there's a risk to log warnings to stderr.
I also think that if someone did'nt care about configuring the logging
machine for 3rd party libraries, this guy just don't care about those
library warnings.
Last question, if no handler is found, why not simply drop the log
event, doing nothing ? It sounds pretty reasonable and less intrusive.
JM
More information about the Python-list
mailing list