From: Ross Burton Date: Thu, 14 Oct 2021 16:33:18 +0000 (+0100) Subject: oe/utils: log exceptions in ThreadedWorker functions X-Git-Tag: uninative-3.5~1192 X-Git-Url: https://code.ossystems.io/gitweb?a=commitdiff_plain;h=2f1ea25c222b344dd8b784b2bc73a6540ab30274;p=openembedded-core.git 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. Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- 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): try: func(self, *args, **kargs) except Exception as e: - print(e) + # Eat all exceptions + bb.mainlogger.debug("Worker task raised %s" % e, exc_info=e) finally: self.tasks.task_done()