Removing default logging handler (causes duplicate logging)

Gerard Flanagan grflanagan at gmail.com
Tue Mar 4 10:35:36 EST 2008


On Mar 4, 1:29 pm, Gal Aviel <galav... at yahoo.com> wrote:
> Hello All,
>
> I want to add a logger to my application, then addHandler to it to log to a
> special destination.
>
> Unfortunately when I use logging.getLogger("my_logger") to create the new
> logger, it apparently comes with a default handler that logs to STDOUT (or
> STDERR?). When I add my special handler it works Ok, but still logs to terminal,
> which I do not want.
>

from docs:
------------------
getLogger( [name])

Return a logger with the specified name or, if no name is specified,
return a logger which is the root logger of the hierarchy.
------------------

so you should do 'root = getlogger()', then append your own logger to
the root.

Gerard



More information about the Python-list mailing list