Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 1/7] qemurunner: Ensure logging handler is removed
Date: Thu,  9 Nov 2017 11:55:45 +0000	[thread overview]
Message-ID: <1510228551-11516-1-git-send-email-richard.purdie@linuxfoundation.org> (raw)

If we don't remove the handler we end up with duplicate log messages
which is undesireable.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/lib/oeqa/utils/qemurunner.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 72f05d5..aa2600b 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -58,7 +58,8 @@ class QemuRunner:
         self.host_dumper = HostDumper(dump_host_cmds, dump_dir)
 
         self.logger = logging.getLogger("BitBake.QemuRunner")
-        self.logger.addHandler(logging.StreamHandler(sys.stdout))
+        self.handler = logging.StreamHandler(sys.stdout)
+        self.logger.addHandler(self.handler)
 
     def create_socket(self):
         try:
@@ -370,6 +371,7 @@ class QemuRunner:
         self.ip = None
         if os.path.exists(self.qemu_pidfile):
             os.remove(self.qemu_pidfile)
+        self.logger.removeHandler(self.handler)
 
     def stop_qemu_system(self):
         if self.qemupid:
-- 
2.7.4



             reply	other threads:[~2017-11-09 11:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 11:55 Richard Purdie [this message]
2017-11-09 11:55 ` [PATCH 2/7] oeqa/runqemu: Only show stdout/stderr upon test failure Richard Purdie
2017-11-09 13:04   ` Patrick Ohly
2017-11-09 13:23     ` Richard Purdie
2017-11-09 11:55 ` [PATCH 3/7] oeqa/targetcontrol: Drop unused get_target_controller function Richard Purdie
2017-11-09 11:55 ` [PATCH 4/7] oeqa/qemurunner: Use logger.debug, not logger.info Richard Purdie
2017-11-09 11:55 ` [PATCH 5/7] testimage: Pass the logger into OERuntimeTestContextExecutor.getTarget() Richard Purdie
2017-11-09 11:55 ` [PATCH 6/7] oeqa: Clean up logger handling Richard Purdie
2017-11-09 11:55 ` [PATCH 7/7] oeqa/target/ssh: Drop command/output logging to debug level Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1510228551-11516-1-git-send-email-richard.purdie@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox