mdoTomofumi Chiba
7/21/2023, 9:15:23 AM

Java の Exception の stack trace を文字列にする

String getStackTraceAsString(Exception e) {
    var writer = new StringWriter();
    e.printStackTrace(new PrintWriter(writer));
    writer.flush();
    return writer.toString();
}
TweetLike