I want to write a simple Java agent that can print the name of a method called by the java program.
For example, my Java program that I want to use is:
public class TestInstr {
public static void sayHello() {
System.out.println("Hello !");
}
public static void main(String args[]) {
sayHello();
sayHello();
sayHello();
}
}
I would like to show something like this:
method sayHello has been called
Hello !
method sayHello has been called
Hello !
method sayHello has been called
Hello !
Thank you for your help!
source
share