Hello,
You have two options:
1)
Thread.currentThread().getStackTrace()
This will return an array of StackTraceElements that represent the current stack trace of a program.
Learn more:
here2)
String fullStackTrace = org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace(e);
if you use Apache Commons
Good luck and have a nice day