Bug 1771

Summary: Log bitbake console messages by default
Product: [Build System, Metadata & Runtime] BitBake Reporter: Darren Hart <dvhart>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: Medium CC: poky.bs.watcher, poky.watcher
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Multiple   
Whiteboard: Patches for this out for review on the mailing lists
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Darren Hart 2011-11-17 13:40:08 UTC
When issues arise, a log of the bitbake output is often helpful (not just the logs under the package temp directories). Users don't typically do this, and for hard to reproduce bugs, regenerating a log may not be doable.

I'm using the following script, which I posted to the mailing list here:
https://lists.yoctoproject.org/pipermail/yocto/2011-November/005527.html
where it received some discussion. It seems this sort of thing may generally useful.

#!/bin/bash
TIMESTAMP=$(date -u "+%Y%m%d%H%M%S")
LOG=$(mktemp --suffix=".log" bb-$TIMESTAMP-XXX)
if [ -z "$LOG" ]; then
	echo "ERROR: failed to create log file"
	exit 1
fi

(
	echo "Start: $TIMESTAMP"
	echo "========================================"
	/usr/bin/time 2>&1 -v bitbake $@
	echo "========================================"
	echo "End: $(date -u '+%Y%m%d%H%M%S')"
) | tee $LOG

echo "Logfile: $LOG"
Comment 1 Richard Purdie 2011-11-17 14:48:23 UTC
I think given the log handling code we have in bitbake, we should just mirror the console output to a logfile somewhere in TMPDIR automatically...
Comment 2 Darren Hart 2011-11-17 15:24:48 UTC
(In reply to comment #1)
> I think given the log handling code we have in bitbake, we should just mirror
> the console output to a logfile somewhere in TMPDIR automatically...

That sounds like a good approach to me as well.