I\'m curious as to what the difference is between printStackTrace() and toString(). At first sight, they seem to do the exact same thing.
Code:
There is an Open Source java library called MgntUtils (written by me) that provides several methods that allow you to extract stacktrace as a String as well as to optionally filter based on parametric package prefix. See the javadoc for the method public static java.lang.String getStacktrace(java.lang.Throwable e, boolean cutTBS, java.lang.String relevantPackage) The library is available at Maven Central and Github