// 获得当前类名
String clazz = Thread.currentThread() .getStackTrace()[1].getClassName();
// 获得当前方法名
String method = Thread.currentThread() .getStackTrace()[1].getMethodName();
System.out.println("class name: " + clazz + " Method Name " + method);
// 获得上级方法名
String method = Thread.currentThread() .getStackTrace()[2].getMethodName();