How do I know what other methods are called by a method from execution to return?

if you dump through a thread, you can only get information at a certain point in time (incomplete). But if you use JVM monitoring tool sampling, looking for a specific method after the implementation process is too troublesome, is there any other way?

Oct.19,2021

if intrusion into the source code is allowed, I recommend printing the log directly and printing the stack in the log (it is recommended that this information be printed to the DEBUG level).


agent- monitoring sends a message . I think it is absolutely not allowed to invade the source code. This will affect the business, and it is impossible to do this kind of monitoring for all systems.
@ Feng_Yu


method call is actually a process of going into and out of the stack. The thread dump can only see the method's call chain (that is, the stack), because the call chain is all stored in the stack, and the B method call has been off the stack, how can you still get the information about the B method? If you want to know all the methods that are called, the only way is to record the information of the call when the method is called (the log is also a way of recording). In fact, that's what the upstairs means.

Menu