From 7225a48e0b654eb95f207881cf4670912b3319b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Tue, 8 Aug 2017 17:45:58 +0200 Subject: [PATCH] runner: Forward sys.stdout|stderr only to TEST_LOG MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The LoggingFile is used to forward sys.stdout|stderr messages into expected loggers. Using "paramiko" or "fabric" seems like a bug to me. Let's only forward them into TEST_LOG, which also propagates to job.log. Signed-off-by: Lukáš Doktor --- avocado/core/runner.py | 9 ++------- .../runner_remote/avocado_runner_remote/__init__.py | 3 +-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/avocado/core/runner.py b/avocado/core/runner.py index e34fceb9..d62fdd61 100644 --- a/avocado/core/runner.py +++ b/avocado/core/runner.py @@ -17,7 +17,6 @@ Test runner module. """ -import logging import multiprocessing from multiprocessing import queues import os @@ -301,12 +300,8 @@ class TestRunner(object): :type queue: :class:`multiprocessing.Queue` instance. """ signal.signal(signal.SIGTSTP, signal.SIG_IGN) - logger_list_stdout = [TEST_LOG, - logging.getLogger('paramiko')] - logger_list_stderr = [TEST_LOG, - logging.getLogger('paramiko')] - sys.stdout = output.LoggingFile(loggers=logger_list_stdout) - sys.stderr = output.LoggingFile(loggers=logger_list_stderr) + sys.stdout = output.LoggingFile(loggers=[TEST_LOG]) + sys.stderr = output.LoggingFile(loggers=[TEST_LOG]) def sigterm_handler(signum, frame): # pylint: disable=W0613 """ Produce traceback on SIGTERM """ diff --git a/optional_plugins/runner_remote/avocado_runner_remote/__init__.py b/optional_plugins/runner_remote/avocado_runner_remote/__init__.py index eae429b1..b77e8716 100644 --- a/optional_plugins/runner_remote/avocado_runner_remote/__init__.py +++ b/optional_plugins/runner_remote/avocado_runner_remote/__init__.py @@ -483,10 +483,9 @@ class RemoteTestRunner(TestRunner): fabric_logger.addHandler(file_handler) paramiko_logger.addHandler(file_handler) remote_logger.addHandler(file_handler) - logger_list = [fabric_logger] if self.job.args.show_job_log: - logger_list.append(app_logger) output.add_log_handler(paramiko_logger.name) + logger_list = [output.LOG_JOB] sys.stdout = output.LoggingFile(loggers=logger_list) sys.stderr = output.LoggingFile(loggers=logger_list) try: -- GitLab