异常堆栈日志打印方法

public static String getStackTrace(Throwable throwable)

  {

    StringWriter sw = new StringWriter();

    PrintWriter pw = new PrintWriter(sw, true);

    throwable.printStackTrace(pw);

    return sw.getBuffer().toString();

  }

将异常打印出来

你可能感兴趣的:(异常)