getTrace()

  • Post author:
  • Post category:其他


	/**
	 * 将e.printStackTrace()函数输出的对象转换为字符串输出
	 * @param e
	 * @return
	 */
	public static String getTrace(Throwable e) {
		StringWriter stringWriter = new StringWriter();
		PrintWriter writer = new PrintWriter(stringWriter);
		e.printStackTrace(writer);
		StringBuffer buffer = stringWriter.getBuffer();
		return buffer.toString();
	}



版权声明:本文为conkeyn原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。