From: Daniel P. Berrangé Date: Tue, 28 Oct 2025 18:26:50 +0000 (+0000) Subject: tests/functional: include logger name and function in messages X-Git-Tag: v10.2.0-rc1~25^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=693bfeb8b2637782a2a5e3cab240765d9e5eced7;p=thirdparty%2Fqemu.git tests/functional: include logger name and function in messages As we collect debug logs from a wide range of code it becomes increasingly confusing to understand where each log messages comes from. Adding "%(name)s" gives us the logger name, which is usually based on the python __name__ symbol, aka the code module name. Then "%(funcName)s" completes the story by identifying the function. Signed-off-by: Daniel P. Berrangé Reviewed-by: Thomas Huth Message-ID: <20251028182651.873256-2-berrange@redhat.com> Signed-off-by: Thomas Huth --- diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu_test/testcase.py index a122acb560..d9d114e63e 100644 --- a/tests/functional/qemu_test/testcase.py +++ b/tests/functional/qemu_test/testcase.py @@ -217,7 +217,7 @@ class QemuBaseTest(unittest.TestCase): self._log_fh = logging.FileHandler(self.log_filename, mode='w') self._log_fh.setLevel(logging.DEBUG) fileFormatter = logging.Formatter( - '%(asctime)s - %(levelname)s: %(message)s') + '%(asctime)s - %(levelname)s: %(name)s.%(funcName)s %(message)s') self._log_fh.setFormatter(fileFormatter) self.log.addHandler(self._log_fh)