sometimes,code call embeded too complex,we want know what is the call stack from a point of code.
we can do it like this
logger.debug(stackTraceToString(Thread.currentThread().getStackTrace()));
public String stackTraceToString(StackTraceElement[] ste){
StringBuilder sb = new StringBuilder();
for (StackTraceElement element : ste) {
sb.append(element.toString());
sb.append("\n");
}
return sb.toString();
}
No comments:
Post a Comment