_clear_all_handlers will sometimes double close a handler, in this case
a KeyError will be raised. http://bugs.python.org/issue8581

Review URL: http://gerrit.chromium.org/gerrit/#change,3705

Signed-off-by: Dale Curtis <[email protected]>
---
 client/common_lib/logging_config.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/client/common_lib/logging_config.py 
b/client/common_lib/logging_config.py
index 587296b..d03de29 100644
--- a/client/common_lib/logging_config.py
+++ b/client/common_lib/logging_config.py
@@ -95,7 +95,12 @@ class LoggingConfig(object):
     def _clear_all_handlers(self):
         for handler in list(self.logger.handlers):
             self.logger.removeHandler(handler)
-            handler.close()
+            # Attempt to close the handler. If it's already closed a KeyError
+            # will be generated. http://bugs.python.org/issue8581
+            try:
+                handler.close()
+            except KeyError:
+                pass
 
 
     def configure_logging(self, use_console=True, verbose=False):
-- 
1.7.3.1

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to