Skip to content

Commit

Permalink
add error stack in biz history record message (#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvjing2 authored Nov 27, 2024
1 parent 7ab39b4 commit 96f5fc2
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand Down Expand Up @@ -343,7 +345,7 @@ private void doStart(String[] args, Map<String, String> envs) throws Throwable {
getIdentity(), (System.currentTimeMillis() - start));
}
} catch (Throwable e) {
setBizState(BizState.BROKEN, StateChangeReason.INSTALL_FAILED, e.getMessage());
setBizState(BizState.BROKEN, StateChangeReason.INSTALL_FAILED, getStackTraceAsString(e));
eventAdminService.sendEvent(new AfterBizStartupFailedEvent(this, e));
throw e;
} finally {
Expand Down Expand Up @@ -642,4 +644,11 @@ private static String markBizTempWorkDirRecycled(File bizTempWorkDir) throws IOE

return targetPath;
}

private static String getStackTraceAsString(Throwable throwable) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
throwable.printStackTrace(pw);
return sw.toString();
}
}

0 comments on commit 96f5fc2

Please sign in to comment.