From c6eaef01c5d676be6a3a11af5c1c38ed0dd0dd7c Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Mon, 21 Sep 2015 16:07:57 +0300 Subject: bitbake: 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(). (Bitbake rev: 74d67be7a4b591fab2278f7c184f282d11620c62) Signed-off-by: Markus Lehtonen Signed-off-by: Richard Purdie --- bitbake/lib/bb/tinfoil.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'bitbake/lib/bb/tinfoil.py') diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py index 1ea46d8eec..7aa653f1aa 100644 --- a/bitbake/lib/bb/tinfoil.py +++ b/bitbake/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): -- cgit v1.2.3-54-g00ecf