summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross@burtonini.com>2021-10-14 17:33:18 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-18 13:48:16 +0100
commitf59811aeeb1fe7048c177c9ff0268bfc1a521b96 (patch)
tree235b01e5bbc9ff079cf7933261920029861c7002
parent4359dba4febb40c87c8bb47c42f94d0204f41844 (diff)
downloadpoky-f59811aeeb1fe7048c177c9ff0268bfc1a521b96.tar.gz
oe/utils: log exceptions in ThreadedWorker functions
If the function a ThreadedWorker is executing raises an exception, don't use print() as that mostly disappears. Instead, output it to the logger. This is done using bb.mainlogger.debug directly instead of bb.debug() as this allows us to pass the exception instance directly, which is then incorporated into the log stream. (From OE-Core rev: 2f1ea25c222b344dd8b784b2bc73a6540ab30274) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 238af314d1..cf65639647 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -508,7 +508,8 @@ class ThreadedWorker(Thread):
508 try: 508 try:
509 func(self, *args, **kargs) 509 func(self, *args, **kargs)
510 except Exception as e: 510 except Exception as e:
511 print(e) 511 # Eat all exceptions
512 bb.mainlogger.debug("Worker task raised %s" % e, exc_info=e)
512 finally: 513 finally:
513 self.tasks.task_done() 514 self.tasks.task_done()
514 515