Created
April 28, 2014 07:04
-
-
Save tkt028/11363797 to your computer and use it in GitHub Desktop.
Get string of current stacktrace in Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get current stack trace in Java | |
// - http://stackoverflow.com/questions/1069066/get-current-stack-trace-in-java | |
// - http://stackoverflow.com/questions/944991/is-there-a-way-to-dump-a-stack-trace-without-throwing-an-exception-in-java | |
// - http://javarevisited.blogspot.com/2013/04/how-to-get-current-stack-trace-in-java-thread.html | |
import org.apache.commons.lang.exception.ExceptionUtils; | |
public void testGetListElevesOfClassInEnclassmentForNonViecourante() { | |
String fullStackTrace = ExceptionUtils.getFullStackTrace(new Throwable("TKT Unit Test")); | |
System.out.println(fullStackTrace); | |
} | |
- Another option | |
import java.util.Arrays; | |
Arrays.toString(e.getStackTrace()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment