From 2bbe44194e563c4f1d6049ce4d5094760d25b21e Mon Sep 17 00:00:00 2001 From: Lei Yang Date: Wed, 2 Mar 2016 23:29:41 +0800 Subject: [PATCH] run-fbp-tests: Fix bug #1516 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to https://docs.python.org/2/library/logging.html#module-level-functions, the logging instantiation in tools/run-fbp-runner is incorrect: root = logging.getLogger() hdlr = root.handlers[0] fmt = logging.Formatter('%(message)s') hdlr.setFormatter(fmt) hdlr.setLevel(level) before invoke getLogger(), python script should call basicConfig() to ensure that at least one handler is available. Signed-off-by: Lei Yang --- tools/run-fbp-tests | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/run-fbp-tests b/tools/run-fbp-tests index 6bb618d14..badf2a7e9 100755 --- a/tools/run-fbp-tests +++ b/tools/run-fbp-tests @@ -321,11 +321,7 @@ def set_log_level(args): if not level: raise ValueError('Invalid log level: %s' % args.log) - root = logging.getLogger() - hdlr = root.handlers[0] - fmt = logging.Formatter('%(message)s') - hdlr.setFormatter(fmt) - hdlr.setLevel(level) + logging.basicConfig(level=level, format='%(message)s') if __name__ == "__main__": parser = argparse.ArgumentParser()