Browse Source

server/process: Prefix the log data with pid/time information

Knowing which process printed which messages and the timestamp of the
message is useful for debugging, so add this. Ensure the log parsing
isn't affected by using search() instead of match().

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Richard Purdie 3 years ago
parent
commit
1d04366671
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lib/bb/server/process.py

+ 2 - 2
lib/bb/server/process.py

@@ -36,7 +36,7 @@ class ProcessTimeout(SystemExit):
     pass
 
 def serverlog(msg):
-    print(msg)
+    print(str(os.getpid()) + " " +  datetime.datetime.now().strftime('%H:%M:%S.%f') + " " + msg)
     sys.stdout.flush()
 
 class ProcessServer():
@@ -480,7 +480,7 @@ class BitBakeServer(object):
                             lines.append(line)
                         else:
                             lastlines.append(line)
-                            res = logstart_re.match(line.rstrip())
+                            res = logstart_re.search(line.rstrip())
                             if res:
                                 ldatetime = datetime.datetime.strptime(res.group(2), start_log_datetime_format)
                                 if ldatetime >= startdatetime: