]> 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)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 17 Oct 2021 11:14:29 +0000 (12:14 +0100)
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>
meta/lib/oe/utils.py

index 238af314d1fdf0a11e7561f3e46d63b67eaf8667..cf65639647b6648747f0eae4e6bca81f74239043 100644 (file)
@@ -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()