Here you can find the source of getStackTraceOnly(Throwable throwable)
public static String getStackTraceOnly(Throwable throwable)
//package com.java2s; import java.io.PrintWriter; import java.io.StringWriter; public class Main { public static String getStackTraceOnly(Throwable throwable) { String stackTrace = getStackTrace(throwable); if (stackTrace.indexOf("\tat") != -1) { return stackTrace.substring(stackTrace.indexOf("\tat")); } else {// w w w . j av a 2s . c o m return ""; } } public static String getStackTrace(Throwable throwable) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); throwable.printStackTrace(pw); return sw.toString(); } }