aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-27 11:31:21 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-27 22:15:08 +0000
commitc8c80b404e38fe96f65d6314cd95f4069319f3d6 (patch)
tree4e698f14b66eb3940a62ec146fa3674e7137c671
parent7414b3537e8adfb41a9581d70bf8296c4f7d38c0 (diff)
downloadbitbake-c8c80b404e38fe96f65d6314cd95f4069319f3d6.tar.gz
server/process: Show last 60 lines of the log if the server didn't start
We're seeing issues where the server doesn't start with no logs as to why. Allow the server to print the last 60 log lines just in case this shows us something useful about what is failing. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/server/process.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 4e0d9c2db..38a62fa34 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -412,22 +412,28 @@ class BitBakeServer(object):
logstart_re = re.compile(self.start_log_format % ('([0-9]+)', '([0-9-]+ [0-9:.]+)'))
started = False
lines = []
+ lastlines = []
with open(logfile, "r") as f:
for line in f:
if started:
lines.append(line)
else:
+ lastlines.append(line)
res = logstart_re.match(line.rstrip())
if res:
ldatetime = datetime.datetime.strptime(res.group(2), self.start_log_datetime_format)
if ldatetime >= startdatetime:
started = True
lines.append(line)
+ if len(lastlines) > 60:
+ lastlines = lastlines[-60:]
if lines:
if len(lines) > 10:
bb.error("Last 10 lines of server log for this session (%s):\n%s" % (logfile, "".join(lines[-10:])))
else:
bb.error("Server log for this session (%s):\n%s" % (logfile, "".join(lines)))
+ elif lastlines:
+ bb.error("Server didn't start, last 60 loglines (%s):\n%s" % (logfile, "".join(lastlines)))
else:
bb.error("%s doesn't exist" % logfile)