Is there a way that I can write / write / control / view every method execution inside a Java program.
For instance:
12:30:12 someMethod("argument") 12:30:12 anotherMethos(1, 2, 3) 12:30:13 finalMethod("invalidInputHere1234")
The simple answer is: change the method and insert the entries.
A slightly more complex answer that works even if you cannot change the method: look at aspect programming.
Without changing the code, you can use a debugger or profiler that can record any state change, such as a chronometric time debugger .
Try the following: https://github.com/taobao/TProfiler
You can record your program and then play it with Chronon
You can use the @Loggableannotation from jcabi-aspects , which wraps all the methods you want to debug, using a simple logging mechanism:
@Loggable
@Loggable(Loggable.DEBUG) public String load(URL url) { return url.openConnection().getContent(); }
It is registered through SLF4J .