summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tinfoil.py
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:44:56 +0100
commitc6eaef01c5d676be6a3a11af5c1c38ed0dd0dd7c (patch)
treeeeadced6eae4cf3659225d05537cf4b047969454 /bitbake/lib/bb/tinfoil.py
parentfb26ea36050405a47c032226d525f7bb878e91b9 (diff)
downloadpoky-c6eaef01c5d676be6a3a11af5c1c38ed0dd0dd7c.tar.gz
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 <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tinfoil.py')
-rw-r--r--bitbake/lib/bb/tinfoil.py9
1 files changed, 5 insertions, 4 deletions
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:
36 36
37 # Set up logging 37 # Set up logging
38 self.logger = logging.getLogger('BitBake') 38 self.logger = logging.getLogger('BitBake')
39 console = logging.StreamHandler(output) 39 self._log_hdlr = logging.StreamHandler(output)
40 bb.msg.addDefaultlogFilter(console) 40 bb.msg.addDefaultlogFilter(self._log_hdlr)
41 format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") 41 format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
42 if output.isatty(): 42 if output.isatty():
43 format.enable_color() 43 format.enable_color()
44 console.setFormatter(format) 44 self._log_hdlr.setFormatter(format)
45 self.logger.addHandler(console) 45 self.logger.addHandler(self._log_hdlr)
46 46
47 self.config = CookerConfiguration() 47 self.config = CookerConfiguration()
48 configparams = TinfoilConfigParameters(parse_only=True) 48 configparams = TinfoilConfigParameters(parse_only=True)
@@ -88,6 +88,7 @@ class Tinfoil:
88 self.cooker.shutdown(force=True) 88 self.cooker.shutdown(force=True)
89 self.cooker.post_serve() 89 self.cooker.post_serve()
90 self.cooker.unlockBitbake() 90 self.cooker.unlockBitbake()
91 self.logger.removeHandler(self._log_hdlr)
91 92
92class TinfoilConfigParameters(ConfigParameters): 93class TinfoilConfigParameters(ConfigParameters):
93 94