获取当前运行的类名或者方法
public static String getCurrentMethodName() {
int level = 1;
StackTraceElement[] stacks = new Throwable().getStackTrace();
String methodName = stacks[level].getMethodName();
return methodName;
}
public static String getCurrentClassName() {
int level = 1;
StackTraceElement[] stacks = new Throwable().getStackTrace();
String className = stacks[level].getClassName();
return className;
}