logging module: removing handlers

Diez B. Roggisch deets at nospam.web.de
Wed Nov 21 11:08:14 CET 2007


Michele Simionato wrote:

> On Nov 21, 10:23 am, "Diez B. Roggisch" <de... at nospam.web.de> wrote:
> 
>> I can only guess - but I'd say if you can do
>>
>> foo.removeHandler(h)
>>
>> you can do
>>
>> foo.removeHandler(h)
>> h.close()
>>
>> easily. But not
>>
>> foo.removeHandler(h) # implicit closing
>> bar.addHandler(h)
>>
>> It does kind of make sense if you decouple the life-cycles IMHO.
>>
>> Diez
> 
> But what is the use case for removing an handler without closing it?

Having thought more about this, it _has_ to be that way - think of one
handler attached to several loggers. Removing AND closing it from one would
render it useless for others. You can't want that to happen.

Diez



More information about the Python-list mailing list