From: Markus Lehtonen Date: Mon, 21 Sep 2015 13:07:57 +0000 (+0300) Subject: tinfoil: remove logging handler at shutdown X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=74d67be7a4b591fab2278f7c184f282d11620c62;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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 Signed-off-by: Richard Purdie --- diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py index 1ea46d8eecf..7aa653f1aab 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):