java中获取当前类名,方法名

String clazz = this.getClass().getName(); 
 
String clazz = Thread.currentThread() .getStackTrace()[1].getClassName();


String method = Thread.currentThread() .getStackTrace()[1].getMethodName(); 

猜你喜欢

转载自blog.csdn.net/rhy0619/article/details/78432980