Am 08.12.2010 01:09, schrieb Antoine Pitrou:
On Tue, 7 Dec 2010 23:45:39 +0000 (UTC) Vinay Sajip
wrote: Antoine Pitrou
writes: I thought "error" and "critical" messages were logged to stderr by default? Isn't it the case?
Only if you call basicConfig() or use the logging.debug(), logging.info(), etc. module-level convenience functions (which call basicConfig under the hood).
Why wouldn't it be the default for all logging calls ? Such special cases don't really make things easy to remember.
When is the NullHandler needed? Only for cases where an application developer uses a library which does logging under the covers (for those users who might be interested in logging its operations), but where that application developer doesn't use logging themselves for that application.
You seem pretty tied up to the "application developer" situation. There are cases (scripts, prototyping, etc.) where you certainly want to see error messages (errors should not pass silently) but don't want to configure logging for each of the libraries you use.
But errors don't pass silently, do they? The usual way to present errors is still by raising exceptions. Georg