python logging module problem

Ritesh Raj Sarraf riteshsarraf at gmail.com
Fri Jul 14 06:40:52 EDT 2006


Vinay Sajip wrote:
>
> It's usual to rely on logger levels and to set handler levels for
> additional refinement of what goes to a particular handler's
> destination.
>

The problem is that for StreamHandler, logging module logs to
sys.stderr.
I want to use the logging feature for most of the messages my program
displays.

So some messages would be going to sys.stdout and some to sys.stderr.

So, I'm ended up creating two handlers, one for sys.stdout and the
other for sys.stderr.
I'd then make INFO level messages go to sys.stdout and DEBUG level
messages go to sys.stderr.

What do you suggest ??
Is it good doing this way ?

Ritesh




More information about the Python-list mailing list