]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe/utils: log exceptions in ThreadedWorker functions
authorRoss Burton <ross@burtonini.com>
Thu, 14 Oct 2021 16:33:18 +0000 (17:33 +0100)
committerAnuj Mittal <anuj.mittal@intel.com>
Mon, 1 Nov 2021 15:18:14 +0000 (23:18 +0800)
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 <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 2f1ea25c222b344dd8b784b2bc73a6540ab30274)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
meta/lib/oe/utils.py

index a84039f58552c208a2aab8fc41b9e1b612058944..2a8771dc28b89da0bcb854d68b60b98c7a6b28b0 100644 (file)
@@ -480,7 +480,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()