diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2017-03-24 01:45:02 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-26 13:17:02 +0100 |
commit | b139790422bc8e0d80bad063bb78bc1632731bc1 (patch) | |
tree | 617a76e2d39bba85cc1d57021a40e69979d57885 /meta/lib/oeqa/selftest | |
parent | e7073cb4786411bb71645e7d7cbc1c510910c4cc (diff) | |
download | openembedded-core-contrib-b139790422bc8e0d80bad063bb78bc1632731bc1.tar.gz |
targetcontrol.py: use logger.info to replace of bb.note
The bb.note prints multiple same lines when invoke this class again, but
if we set mainlogger.propagate = False, nothing would be printed,
according to logging's document:
https://docs.python.org/3/library/logging.html
Note
If you attach a handler to a logger and one or more of its ancestors, it
may emit the same record multiple times. In general, you should not need
to attach a handler to more than one logger - if you just attach it to
the appropriate logger which is highest in the logger hierarchy, then it
will see all events logged by all descendant loggers, provided that
their propagate setting is left set to True. A common scenario is to
attach handlers only to the root logger, and to let propagation take
care of the rest.
We may need avoid using bb.note or bb.warn in oeqa since it attaches
multiple log handlers which may cause confusions
This patch only sets "mainlogger.propagate = False" in
selftest/runqemu.py and use logger.info to replace bb.note in
targetcontrol.py to minimize the impact.
[YOCTO #10249]
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r-- | meta/lib/oeqa/selftest/runqemu.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/runqemu.py b/meta/lib/oeqa/selftest/runqemu.py index c1d5c16e81..58c6f96f98 100644 --- a/meta/lib/oeqa/selftest/runqemu.py +++ b/meta/lib/oeqa/selftest/runqemu.py @@ -21,6 +21,10 @@ class RunqemuTests(oeSelfTest): self.fstypes = "ext4 iso hddimg vmdk qcow2 vdi" self.cmd_common = "runqemu nographic" + # Avoid emit the same record multiple times. + mainlogger = logging.getLogger("BitBake.Main") + mainlogger.propagate = False + self.write_config( """ MACHINE = "%s" |