Here you can find the source of getStackTrace(Exception e)
Parameter | Description |
---|---|
e | the exception |
public static final String getStackTrace(Exception e)
//package com.java2s; import java.io.PrintWriter; import java.io.StringWriter; public class Main { /**//ww w . java 2 s.c o m * Returns the stack trace of the given exception in a string. * @param e the exception * @return String */ public static final String getStackTrace(Exception e) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); return sw.toString(); } }