提交 7225a48e 编写于 作者: L Lukáš Doktor

runner: Forward sys.stdout|stderr only to TEST_LOG

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: NLukáš Doktor <ldoktor@redhat.com>
上级 ed4bf8bc
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
Test runner module. Test runner module.
""" """
import logging
import multiprocessing import multiprocessing
from multiprocessing import queues from multiprocessing import queues
import os import os
...@@ -301,12 +300,8 @@ class TestRunner(object): ...@@ -301,12 +300,8 @@ class TestRunner(object):
:type queue: :class:`multiprocessing.Queue` instance. :type queue: :class:`multiprocessing.Queue` instance.
""" """
signal.signal(signal.SIGTSTP, signal.SIG_IGN) signal.signal(signal.SIGTSTP, signal.SIG_IGN)
logger_list_stdout = [TEST_LOG, sys.stdout = output.LoggingFile(loggers=[TEST_LOG])
logging.getLogger('paramiko')] sys.stderr = output.LoggingFile(loggers=[TEST_LOG])
logger_list_stderr = [TEST_LOG,
logging.getLogger('paramiko')]
sys.stdout = output.LoggingFile(loggers=logger_list_stdout)
sys.stderr = output.LoggingFile(loggers=logger_list_stderr)
def sigterm_handler(signum, frame): # pylint: disable=W0613 def sigterm_handler(signum, frame): # pylint: disable=W0613
""" Produce traceback on SIGTERM """ """ Produce traceback on SIGTERM """
......
...@@ -483,10 +483,9 @@ class RemoteTestRunner(TestRunner): ...@@ -483,10 +483,9 @@ class RemoteTestRunner(TestRunner):
fabric_logger.addHandler(file_handler) fabric_logger.addHandler(file_handler)
paramiko_logger.addHandler(file_handler) paramiko_logger.addHandler(file_handler)
remote_logger.addHandler(file_handler) remote_logger.addHandler(file_handler)
logger_list = [fabric_logger]
if self.job.args.show_job_log: if self.job.args.show_job_log:
logger_list.append(app_logger)
output.add_log_handler(paramiko_logger.name) output.add_log_handler(paramiko_logger.name)
logger_list = [output.LOG_JOB]
sys.stdout = output.LoggingFile(loggers=logger_list) sys.stdout = output.LoggingFile(loggers=logger_list)
sys.stderr = output.LoggingFile(loggers=logger_list) sys.stderr = output.LoggingFile(loggers=logger_list)
try: try:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册