summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-06-07 21:04:17 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-06-12 15:07:39 +0100
commit55c4781cdef853480d9e9d94f5aee26c512777c3 (patch)
treeb7f877deb09b02ee206815a2fd145b9ec5bf048d
parentd44d5a2e79affce73750561c1e1ca58f8fcb7bb1 (diff)
downloadpoky-55c4781cdef853480d9e9d94f5aee26c512777c3.tar.gz
bitbake: knotty: prevent extra logger from being enabled for tinfoil
tinfoil sets up its own logger by default, but if and when we initialise the UI (by default knotty) will also set one up, leading to duplicated messages specifically from tasks. To avoid this, rather than adding some kind of parameter, just check if there is already a logger outputting to stdout/stderr and if so, skip adding our own. Part of the fix for [YOCTO #11275]. (Bitbake rev: 66d866745f35468d1540a793d07e3a401298b84b) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/msg.py7
-rw-r--r--bitbake/lib/bb/ui/knotty.py5
2 files changed, 10 insertions, 2 deletions
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py
index 90b158238f..f1723be797 100644
--- a/bitbake/lib/bb/msg.py
+++ b/bitbake/lib/bb/msg.py
@@ -216,3 +216,10 @@ def logger_create(name, output=sys.stderr, level=logging.INFO, preserve_handlers
216 logger.handlers = [console] 216 logger.handlers = [console]
217 logger.setLevel(level) 217 logger.setLevel(level)
218 return logger 218 return logger
219
220def has_console_handler(logger):
221 for handler in logger.handlers:
222 if isinstance(handler, logging.StreamHandler):
223 if handler.stream in [sys.stderr, sys.stdout]:
224 return True
225 return False
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 82aa7c4644..a19c3b3ba5 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -365,8 +365,9 @@ def main(server, eventHandler, params, tf = TerminalFilter):
365 bb.msg.addDefaultlogFilter(errconsole, bb.msg.BBLogFilterStdErr) 365 bb.msg.addDefaultlogFilter(errconsole, bb.msg.BBLogFilterStdErr)
366 console.setFormatter(format) 366 console.setFormatter(format)
367 errconsole.setFormatter(format) 367 errconsole.setFormatter(format)
368 logger.addHandler(console) 368 if not bb.msg.has_console_handler(logger):
369 logger.addHandler(errconsole) 369 logger.addHandler(console)
370 logger.addHandler(errconsole)
370 371
371 bb.utils.set_process_name("KnottyUI") 372 bb.utils.set_process_name("KnottyUI")
372 373