In larger applications, a particular point of code can be achieved by multiple paths. This makes debugging that much more difficult. One alternative is to put debug statements in all possible method calls, which are then called during any of all such possible flows. This is a complicated solution.
Another alternative is to use the dumpStack() method of thread as follows:
is a static method and prints the stack trace which is similar to Exception trace.