summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxim Siniavine <siniavine@google.com>2017-04-05 11:14:09 -0700
committerMaxim Siniavine <siniavine@google.com>2017-04-05 12:27:45 -0700
commit1d082700cdcf9faa5b761c8e1f3618208efa2e77 (patch)
tree1b76f321eb415f82571d065f5e6966a714c286ee /src
parentffcec1bb6c2be881d65994f727b3c5d1c5b7210f (diff)
downloadloganalysis-1d082700cdcf9faa5b761c8e1f3618208efa2e77.tar.gz
Fix logcat parsing in bugreports.
A UID column was added to the logcat log. Update the regular expresion to accept the new column. BUG: 36891877 TEST: Run local unit test. Run command line parser to parse bugreport. Change-Id: I514f5d81edacd4296959e30ebc63796c347c74f5
Diffstat (limited to 'src')
-rw-r--r--src/com/android/loganalysis/parser/LogcatParser.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/com/android/loganalysis/parser/LogcatParser.java b/src/com/android/loganalysis/parser/LogcatParser.java
index 96cd1c2..b32536d 100644
--- a/src/com/android/loganalysis/parser/LogcatParser.java
+++ b/src/com/android/loganalysis/parser/LogcatParser.java
@@ -54,12 +54,18 @@ public class LogcatParser implements IParser {
/**
* Match a single line of `logcat -v threadtime`, such as:
- * 05-26 11:02:36.886 5689 5689 D AndroidRuntime: CheckJNI is OFF
+ *
+ * <pre>05-26 11:02:36.886 5689 5689 D AndroidRuntime: CheckJNI is OFF.</pre>
*/
- private static final Pattern THREADTIME_LINE = Pattern.compile(
- "^(\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d{3})\\s+" + /* timestamp [1] */
- "(\\d+)\\s+(\\d+)\\s+([A-Z])\\s+" + /* pid/tid and log level [2-4] */
- "(.+?)\\s*: (.*)$" /* tag and message [5-6]*/);
+ private static final Pattern THREADTIME_LINE =
+ // UID was added to logcat. It could either be a number or a string.
+ Pattern.compile(
+ // timestamp[1]
+ "^(\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d{3})"
+ // pid/tid and log level [2-4]
+ + "(?:\\s+[0-9A-Za-z]+)?\\s+(\\d+)\\s+(\\d+)\\s+([A-Z])\\s+"
+ // tag and message [5-6]
+ + "(.+?)\\s*: (.*)$");
/**
* Match a single line of `logcat -v time`, such as: