Example of how to use logging for both screen and file

Ville Vainio ville at spammers.com
Wed Oct 27 14:08:16 CEST 2004


>>>>> "Steve" == Steve  <lonetwin at gmail.com> writes:

    Steve> flog = logging.getLogger("mylog")
    Steve> slog = logging.getLogger("mylog.slog")

I'm a logging newbie, but - 

You shouldn't "get" loggers according to the "log name", but rather
the application area name. I.e.

log = logging.getLogger("myApp")

And then add different handlers to the same log object. I.e. don't
create several loggers, create several handlers for the same Logger
object, as I did in the initial example of this thread (just
substitute StreamHandler w/ sysloghandler).

-- 
Ville Vainio   http://tinyurl.com/2prnb



More information about the Python-list mailing list