异常的日志的输出,堆栈里面的异常信息输出

/**
 * Read the stacktrace of the supplied {@link Throwable} into a String.
 */
public static String readStackTrace(Throwable throwable) {
   Preconditions.notNull(throwable, "Throwable must not be null");
   StringWriter stringWriter = new StringWriter();
   try (PrintWriter printWriter = new PrintWriter(stringWriter)) {
      throwable.printStackTrace(printWriter);
   }
   return stringWriter.toString();
}

猜你喜欢

转载自blog.csdn.net/yz18931904/article/details/131471076