Here you can find the source of getStackTrace(final Throwable t)
Parameter | Description |
---|---|
t | the throwable (including exceptions) with the stack trace. |
public static String getStackTrace(final Throwable t)
//package com.java2s; import java.io.PrintWriter; import java.io.StringWriter; public class Main { /**// ww w.j a v a2 s . c om * Get a stack trace as a string. * @param t the throwable (including exceptions) with the stack trace. * @return the stack trace. */ public static String getStackTrace(final Throwable t) { final StringWriter sw = new StringWriter(); t.printStackTrace(new PrintWriter(sw)); return sw.toString(); } }