commit b14696c20c536b616d0eb62e0dc88b44f5856050 Author: Jan Tluka jtluka@redhat.com Date: Tue Nov 27 17:01:57 2012 +0100
Fix logging issue with python2.6
This patch fixes logging issue that caused that the logs for a recipe were appended with content of further recipes in the test run. This issue was seen only with python2.6. It's type() built-in function did not worked properly and python documentation recommends to use isinstance() instead. This issue was not seen with python2.7.
Also, in case of passing recipe directory the typo was discovered and fixed, root_logger was incorrectly written as logger.
Signed-off-by: Jan Tluka jtluka@redhat.com
lnst/Common/Logs.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) --- diff --git a/lnst/Common/Logs.py b/lnst/Common/Logs.py index e9c33ea..799f5da 100644 --- a/lnst/Common/Logs.py +++ b/lnst/Common/Logs.py @@ -198,7 +198,7 @@ class Logs: for logger in cls.loggers: handlers = list(logger.handlers) for handler in handlers: - if type(handler) == logging.FileHandler: + if isinstance(handler, logging.FileHandler): logger.removeHandler(handler)
cls.loggers = cls.loggers[:1] @@ -242,8 +242,8 @@ class Logs:
handlers = list(root_logger.handlers) for handler in handlers: - if type(handler) == logging.FileHandler: - logger.removeHandler(handler) + if isinstance(handler, logging.FileHandler): + root_logger.removeHandler(handler)
(file_debug, file_info) = cls._create_file_handler(cls.root_path) root_logger.addHandler(file_debug)
lnst-developers@lists.fedorahosted.org