[Zope3-checkins] CVS: Zope3/lib/python/logging - config.py:1.3
Guido van Rossum
guido@python.org
Thu, 19 Dec 2002 20:55:03 -0500
Update of /cvs-repository/Zope3/lib/python/logging
In directory cvs.zope.org:/tmp/cvs-serv6368
Modified Files:
config.py
Log Message:
(Backport from Python 2.3 CVS.)
Fix what I believe is a bug: when removing all previous handlers,
should copy the handlers list because it's being modified by the loop.
=== Zope3/lib/python/logging/config.py 1.2 => 1.3 ===
--- Zope3/lib/python/logging/config.py:1.2 Wed Dec 11 16:17:09 2002
+++ Zope3/lib/python/logging/config.py Thu Dec 19 20:55:00 2002
@@ -141,7 +141,7 @@
if "level" in opts:
level = cp.get(sectname, "level")
log.setLevel(logging._levelNames[level])
- for h in root.handlers:
+ for h in root.handlers[:]:
root.removeHandler(h)
hlist = cp.get(sectname, "handlers")
if len(hlist):
@@ -173,7 +173,7 @@
if "level" in opts:
level = cp.get(sectname, "level")
logger.setLevel(logging._levelNames[level])
- for h in logger.handlers:
+ for h in logger.handlers[:]:
logger.removeHandler(h)
logger.propagate = propagate
logger.disabled = 0