aboutsummaryrefslogtreecommitdiffstats
path: root/test/framework.py
diff options
context:
space:
mode:
authorjuraj.linkes <juraj.linkes@pantheon.tech>2018-11-09 11:58:54 +0100
committerFlorin Coras <florin.coras@gmail.com>2018-11-09 23:33:59 +0000
commitdfb5f2aff3675b3d70ba024dfd367c688ea1def6 (patch)
tree814924c0a84981ed1ea8bc4605659aeb5ca5de1f /test/framework.py
parentd5969e4a7b5aa4a51ee65a86e80e8ca3ae01c2a5 (diff)
Fix logging into multiple files
When running tests in one process, only one logger was used and each testcase added its own file handler, which resulted in logs appearing in multiple files. Fix this by restoring the creation of new loggers for each testcase and only reuse the stream handler from parent process. Change-Id: I5b8471e041dc769128fddb433d33812bfcb5ecf6 Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
Diffstat (limited to 'test/framework.py')
-rw-r--r--test/framework.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/framework.py b/test/framework.py
index 27fcdb5a7f6..3201e632348 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -25,7 +25,7 @@ from vpp_lo_interface import VppLoInterface
from vpp_papi_provider import VppPapiProvider
from vpp_papi.vpp_stats import VPPStats
from log import RED, GREEN, YELLOW, double_line_delim, single_line_delim, \
- getLogger, colorize
+ get_logger, colorize
from vpp_object import VppObjectRegistry
from util import ppp, is_core_present
from scapy.layers.inet import IPerror, TCPerror, UDPerror, ICMPerror
@@ -369,10 +369,9 @@ class VppTestCase(unittest.TestCase):
gc.collect() # run garbage collection first
random.seed()
cls.print_header(cls)
- if not hasattr(cls, 'logger'):
- cls.logger = getLogger(cls.__name__)
- else:
- cls.logger.name = cls.__name__
+ cls.logger = get_logger(cls.__name__)
+ if hasattr(cls, 'parallel_handler'):
+ cls.logger.addHandler(cls.parallel_handler)
cls.tempdir = tempfile.mkdtemp(
prefix='vpp-unittest-%s-' % cls.__name__)
cls.stats_sock = "%s/stats.sock" % cls.tempdir