Call Java logging method?

Are there any tools that can be used to register all method calls from running a java application?

eg.

String str = "...";
String anotherString = str.trim();

should write something like this:

..method call trim() from class java.lang.String
+1
source share
3 answers

You need a profiler.

Some popular profilers are: JProfiler , which has different ways to record a method call, both at the CPU level and at the memory level.

VisualVM is another

Many IDEs (I know Netbeans and Eclipse) have their own profilers that you can use.

+4
source

- AspectJ , . , "" .

+3

You can use the @Loggableannotation from jcabi-aspects , which wraps all the methods you want to debug, using a simple logging mechanism:

@Loggable(Loggable.DEBUG)
public String load(URL url) {
  return url.openConnection().getContent();
}

It is registered through SLF4J .

+1
source

All Articles