Skip to content

Commit 209dead

Browse files
Try to infer a more concrete crash message from client logs (#1233)
1 parent 8434d31 commit 209dead

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/daemon/clientLog/logWatcher.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,23 @@ export class ClientLogWatcher {
5959

6060
const crashLog = logs.find(log => log.message?.startsWith("The Language Support for Java server crashed and will restart."));
6161
info.crash = crashLog ? "true" : undefined;
62+
// try to infer a more concrete crash error message
63+
if (crashLog) {
64+
let message = "";
65+
for (let i = 0; i < logs.length - 1; i++) {
66+
if (Date.parse(log.timestamp) < this.logProcessedTimestamp) {
67+
break;
68+
}
69+
if (logs[i].message?.startsWith("The Language Support for Java server crashed and will restart.")) {
70+
const nextLog = logs[i + 1];
71+
if (nextLog?.level === "info" && nextLog?.message && !nextLog.message?.startsWith("[")
72+
&& (!message || nextLog.message.length > message.length)) {
73+
message = nextLog.message;
74+
}
75+
}
76+
}
77+
info.message = message;
78+
}
6279

6380
sendInfo("", {
6481
name: "client-log-startup-metadata",

0 commit comments

Comments
 (0)