[stdlib-sig] logging
Tarek Ziadé
ziade.tarek at gmail.com
Fri Sep 18 11:28:11 CEST 2009
On Fri, Sep 18, 2009 at 11:18 AM, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
> but you could obviously add a
> loggerName argument that configured and returned a configured logger with that
> name. That wouldn't even break backward compatibility.
That would be great. With an option to make the logger instance 'standalone'
(e.g. blocking the propagation of the messages to the other handler
to avoid the problem
you've described below)
> It's not in general a desirable pattern to have handlers associated with every
> logger - which is why I haven't provided that additional argument. It's more
> common to attach handlers at the root and at certain specific points in the
> hierarchy - for example, attach an SMTP logger to the root module for a
> subsystem so that emails about errors can be sent to the team looking after that
> subsystem.
>
> Of course it's perfectly valid to have handers attached to multiple loggers -
> but if you do that for lots of loggers, you get multiple messages and increased
> processing time. If that's what is wanted, fine - it's just not the norm. But
> having a convenience function which makes it too convenient to configure
> multiple handlers could lead to lots of "I'm getting messages multiple times,
> please help!" traffic on c.l.py.
>
> The basic premise is - loggers map to areas in the application ("Where did it
> happen?") and handlers to the audience ("Who wants to know?"). Apart from in
> scripts intended to be run from the command line, in general you don't find a
> one-to-one mapping between loggers and handlers.
>
>
> _______________________________________________
> stdlib-sig mailing list
> stdlib-sig at python.org
> http://mail.python.org/mailman/listinfo/stdlib-sig
>
--
Tarek Ziadé | http://ziade.org | オープンソースはすごい!
More information about the stdlib-sig
mailing list