]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
Ensure LogHandler is set up for the server construction
authorChris Larson <chris_larson@mentor.com>
Fri, 17 Dec 2010 16:13:18 +0000 (10:13 -0600)
committerChris Larson <chris_larson@mentor.com>
Fri, 17 Dec 2010 16:33:22 +0000 (09:33 -0700)
If we add the LogHandler object in the server.main, rather than earlier, any
log messages emitted during the construction of the server (and, therefore,
during the construction of the cooker) will not be seen.  This includes the
error(s) which the cooker can emit when parsing the command line.  With this,
we again see the error if you try to use -g without specifying a recipe to
operate against.

Signed-off-by: Chris Larson <chris_larson@mentor.com>
bin/bitbake
lib/bb/server/process.py

index fa7caf2180586c68d6497ed4d762971787f2e5ba..10cce2d1388aab946b1c4f7d4848e5b40ccb5b47 100755 (executable)
@@ -174,6 +174,10 @@ Default BBFILES are the .bb files in the current directory.""")
     bb.utils.init_logger(bb.msg, configuration.verbose, configuration.debug,
                          configuration.debug_domains)
 
+    # Ensure logging messages get sent to the UI as events
+    handler = bb.event.LogHandler()
+    logger.addHandler(handler)
+
     # Clear away any spurious environment variables. But don't wipe the
     # environment totally. This is necessary to ensure the correct operation
     # of the UIs (e.g. for DISPLAY, etc.)
@@ -189,6 +193,8 @@ Default BBFILES are the .bb files in the current directory.""")
     server = ProcessServer(server_channel, event_queue, configuration)
     server.start()
 
+    logger.removeHandler(handler)
+
     def shutdown(force=False):
         signal.signal(signal.SIGINT, signal.SIG_IGN)
         server.stop()
index c3aaa7fb9d4cdd4b008a52482ee689734a5f02f1..dac4422921879be6d75928a67d76763996c264ec 100644 (file)
@@ -95,9 +95,6 @@ class ProcessServer(Process):
 
     def main(self):
         """Server main loop"""
-        # Ensure logging messages get sent to the UI as events
-        logger.addHandler(bb.event.LogHandler())
-
         # Ignore SIGINT within the server, as all SIGINT handling is done by
         # the UI and communicated to us
         signal.signal(signal.SIGINT, signal.SIG_IGN)