I made one addition to the code found on this blog:
public static String getCallStack(int skip)
{
StringBuilder sb = new StringBuilder();
StackTraceElement[] stackTraceElements =
Thread.currentThread().getStackTrace();
for (int i = 3 + skip ; i<stackTraceElements.length; i++)
{
StackTraceElement ste = stackTraceElements[i];
String classname = ste.getClassName();
String methodName = ste.getMethodName();
int lineNumber = ste.getLineNumber();
sb.append(classname + "." + methodName + ":" + lineNumber + "\r\n");
}
return sb.toString();
}
No comments:
Post a Comment