summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/build.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-08-12 23:24:43 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-08-15 09:14:28 +0100
commit7ee93b206a6389e6eb7b9440dc2fae801c77bc9b (patch)
tree6700acff792125542187590c5633c61c29b1005b /bitbake/lib/bb/build.py
parentfce0b963b437c5b0660dca6f5b0a099e4befa03c (diff)
downloadpoky-7ee93b206a6389e6eb7b9440dc2fae801c77bc9b.tar.gz
bitbake/logging: Overhaul internal logging process
At the moment it bugs me a lot that we only have one effective logging level for bitbake, despite the logging module having provision to do more advanced things. This patch: * Changes the core log level to the lowest level we have messages of (DEBUG-2) so messages always flow through the core logger * Allows build.py's task logging code to log all the output regardless of what output is on the console and sets this so log files now always contain debug level messages even if these don't appear on the console * Moves the verbose/debug/debug-domains code to be a UI side setting * Adds a filter to the UI to only print the user requested output. The result is more complete logfiles on disk but the usual output to the console. There are some behaviour changes intentionally made by this patch: a) the -v option now controls whether output is tee'd to the console. Ultimately, we likely want to output a message to the user about where the log file is and avoid placing output directly onto the console for every executing task. b) The functions get_debug_levels, the debug_levels variable, the set_debug_levels, the set_verbosity and set_debug_domains functions are removed from bb.msg. c) The "logging" init function changes format. d) All messages get fired to all handlers all the time leading to an increase in inter-process traffic. This could likely be hacked around short term with a function for a UI to only request events greater than level X. Longer term, having masks for event handlers would be better. e) logger.getEffectiveLevel() is no longer a reliable guide to what will/won't get logged so for now we look at the default log levels instead. [YOCTO #304] (Bitbake rev: 45aad2f9647df14bcfa5e755b57e1ddab377939a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/build.py')
-rw-r--r--bitbake/lib/bb/build.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 5c703095b7..31fde06e6a 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -223,7 +223,7 @@ def exec_func_shell(function, d, runfile, cwd=None):
223 223
224 with open(runfile, 'w') as script: 224 with open(runfile, 'w') as script:
225 script.write('#!/bin/sh -e\n') 225 script.write('#!/bin/sh -e\n')
226 if logger.isEnabledFor(logging.DEBUG): 226 if bb.msg.loggerVerbose[1]:
227 script.write("set -x\n") 227 script.write("set -x\n")
228 data.emit_func(function, script, d) 228 data.emit_func(function, script, d)
229 if cwd: 229 if cwd:
@@ -234,7 +234,7 @@ def exec_func_shell(function, d, runfile, cwd=None):
234 234
235 cmd = runfile 235 cmd = runfile
236 236
237 if logger.isEnabledFor(logging.DEBUG): 237 if bb.msg.loggerVerbose[1]:
238 logfile = LogTee(logger, sys.stdout) 238 logfile = LogTee(logger, sys.stdout)
239 else: 239 else:
240 logfile = sys.stdout 240 logfile = sys.stdout
@@ -308,6 +308,8 @@ def _exec_task(fn, task, d, quieterr):
308 # Ensure python logging goes to the logfile 308 # Ensure python logging goes to the logfile
309 handler = logging.StreamHandler(logfile) 309 handler = logging.StreamHandler(logfile)
310 handler.setFormatter(logformatter) 310 handler.setFormatter(logformatter)
311 # Always enable full debug output into task logfiles
312 handler.setLevel(logging.DEBUG - 2)
311 bblogger.addHandler(handler) 313 bblogger.addHandler(handler)
312 314
313 localdata.setVar('BB_LOGFILE', logfn) 315 localdata.setVar('BB_LOGFILE', logfn)