Is there any tools that can be used to log all method calls from running java application?
eg.
String str = "...";
String anotherString = str.trim();
should log something like this:
..method call trim() from class java.lang.String
One method would be to use AspectJ and write advice that intercepts method calls. There is an example of how to do this "tracing" logging in the programmer guide .
You can use @Loggable
annotation from jcabi-aspects , which wraps all methods you want to debug with a simple logging mechanism:
@Loggable(Loggable.DEBUG)
public String load(URL url) {
return url.openConnection().getContent();
}
It logs through SLF4J .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.