[+] Get the current Java method name or class name

1, to obtain the current class name:

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

 

2. Get the current method name:

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

 

 

Guess you like

Origin www.cnblogs.com/danhuai/p/11404033.html