// 当前行号 public static int _LINE_() { StackTraceElement traceElement = ((new Exception()).getStackTrace())[1]; return traceElement.getLineNumber(); }
// 当前时间 public static String _TIME_() { Date now = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); return sdf.format(now); }
public static void printCallStatck() {
Throwable ex = new Throwable();
StackTraceElement[] stackElements = ex.getStackTrace();
if (stackElements != null) {
for (int i = 0; i < stackElements.length; i++) {
System.out.print(stackElements[i].getClassName()+"/t");
System.out.print(stackElements[i].getFileName()+"/t");
System.out.print(stackElements[i].getLineNumber()+"/t");
System.out.println(stackElements[i].getMethodName());
System.out.println("-----------------------------------");
}
}
}
public static void printzkStatck() {
Exception e = new Exception("---stack print---");
e.printStackTrace();
}