Here you can find the source of getStackTrace(Throwable e)
Parameter | Description |
---|---|
e | The exception |
public static String getStackTrace(Throwable e)
//package com.java2s; /* Please see the license information at the end of this file. */ import java.io.*; public class Main { /** Gets a stack trace for an exception. *// ww w. ja v a 2s.c o m * @param e The exception */ public static String getStackTrace(Throwable e) { ByteArrayOutputStream traceByteArrayStream = new ByteArrayOutputStream(); PrintStream tracePrintStream = new PrintStream(traceByteArrayStream); e.printStackTrace(tracePrintStream); tracePrintStream.flush(); return traceByteArrayStream.toString(); } }