You can use %I in your Log4j conversion pattern to print out the name of the method. BUT be warned that "generating caller location information is extremely slow and should be avoided unless execution speed is not an issue."
No, not without editing either the call-sites or the method itself. I think what you're after is something towards aspect oriented programming. Have a look at AspectJ for example.
You can use
%I
in your Log4j conversion pattern to print out the name of the method. BUT be warned that "generating caller location information is extremely slow and should be avoided unless execution speed is not an issue."You can do it with AOP and Java annotations. I would recommend to use
@Loggable
annotation and an AspectJ aspect from jcabi-aspects (I'm a developer):In SLF4J log output you will see method execution time, its parameters, and its name.
No, not without editing either the call-sites or the method itself. I think what you're after is something towards aspect oriented programming. Have a look at AspectJ for example.