String clazz = Thread.currentThread() .getStackTrace()[1].getClassName();
// 获得当前方法名
String method = Thread.currentThread() .getStackTrace()[1].getMethodName();
System.out.println("class name: " + clazz + " Method Name " + method);
在方法内部获取当前类名和方法名
最新推荐文章于 2024-04-28 10:34:48 发布