logging question

Jeff Shannon jeff at ccvcorp.com
Thu Oct 7 03:33:25 CEST 2004

cmedcoff at hotmail.com wrote:

>I going through my first attempt at using the new logging facilities.  I
>would like to have log output go to both a file and std error and perhaps
>email as well.  Is there a handler that allows this sort of multiple outputs
>capture or will a custom handler have to be written?

Each logger can have multiple handlers attached to it, with each of the 
handlers having their own threshold.  You can easily create a file 
handler, a stream (stdout) handler, and an email handler, all attached 
to your (root) logger.  Any logged messages should go to all of the 
attached handlers.  But if you, for example, give the email handler a 
threshold of 'critical', then 'info' and 'error' messages will go to the 
file and to stdout but won't get emailed.

Jeff Shannon
Credit International

More information about the Python-list mailing list