summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2015-09-21 16:07:57 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-23 22:43:49 +0100
commit74d67be7a4b591fab2278f7c184f282d11620c62 (patch)
tree0d261cd15f074664e9a542ab279990f1715234b6
parent0df02c87573bf9a66df2e424cd9534e67a8ab3dc (diff)
downloadbitbake-74d67be7a4b591fab2278f7c184f282d11620c62.zip
tinfoil: remove logging handler at shutdown
Otherwise the logger gets multiple handers (and the user get duplicate logging output) if another tinfoil instance is initialized after one is shut down(). Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/tinfoil.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py
index 1ea46d8e..7aa653f1 100644
--- a/lib/bb/tinfoil.py
+++ b/lib/bb/tinfoil.py
@@ -36,13 +36,13 @@ class Tinfoil:
# Set up logging
self.logger = logging.getLogger('BitBake')
- console = logging.StreamHandler(output)
- bb.msg.addDefaultlogFilter(console)
+ self._log_hdlr = logging.StreamHandler(output)
+ bb.msg.addDefaultlogFilter(self._log_hdlr)
format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
if output.isatty():
format.enable_color()
- console.setFormatter(format)
- self.logger.addHandler(console)
+ self._log_hdlr.setFormatter(format)
+ self.logger.addHandler(self._log_hdlr)
self.config = CookerConfiguration()
configparams = TinfoilConfigParameters(parse_only=True)
@@ -88,6 +88,7 @@ class Tinfoil:
self.cooker.shutdown(force=True)
self.cooker.post_serve()
self.cooker.unlockBitbake()
+ self.logger.removeHandler(self._log_hdlr)
class TinfoilConfigParameters(ConfigParameters):