获取class名:

this.getClass().getName();

或者

Thread.currentThread().getStackTrace()[1].getClassName();

获取方法名:

Thread.currentThread().getStackTrace()[1].getMethodName();

获取行号:

Thread.currentThread().getStackTrace()[1].getLineNumber();

获取文件名(带后缀):

Thread.currentThread().getStackTrace()[1].getFileName();

相关文章:

  • 2021-08-29
  • 2021-04-06
  • 2022-12-23
  • 2021-10-16
  • 2021-10-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2021-10-21
相关资源
相似解决方案