tags:

views:

43

answers:

2

Hi ,

For debug purpose, I want to print out current executing function name in Java. If it were C, I would just do printf("%s \n" ,__FUNCITON__).

+6  A: 
new Exception().getStackTrace()[0].getMethodName();
Sjoerd
A: 

I'd use one of the logging frameworks (logback with slf4j is probably the best one at the moment, but log4j should suffice), then you can specify a layout that will print the method name logback layout documentation here

Rulmeq