Here you can find the source of getStackTraceFromException(Exception _e)
Parameter | Description |
---|---|
_e | the exception this method returns the stack trace of |
public static String getStackTraceFromException(Exception _e)
//package com.java2s; //License from project: Apache License import java.io.PrintWriter; import java.io.StringWriter; public class Main { /**/*from w ww . ja va2s . c o m*/ * Creates a String from the stack trace of an exception. * Usually used to construct a string that's passed to the logger. * * @param _e the exception this method returns the stack trace of * * @return a String containing the complete stack trace of the passed exception */ public static String getStackTraceFromException(Exception _e) { StringWriter sw = new StringWriter(); _e.printStackTrace(new PrintWriter(sw)); return sw.toString(); } }