0

I want to see what lines of code are being executed in my Java program when it runs and terminates. One way I can do this is by using an IDE such as IntelliJ or Eclipse and setting a break point in the main method, then going through each line of code one after another using the step-over and step-into buttons. This becomes extremely tedious to do after a while though, because the program freezes every time I want to know what line of code is executed next.

Is there another way to see what's happening in my Java program, other than using an IDE debugger and setting breakpoints? I would also like to be able to use my program like a normal user would be able to (i.e. not being paused every few seconds because of my IDE).

5
  • 2
    java.util.logging or log4j or slf4j? Commented Jun 20, 2016 at 20:36
  • I mean, if you really wanted to keep it simple, you could just use System.out.println instead of a fancy logger if it's for sanity checking. Commented Jun 20, 2016 at 20:37
  • I'm aware of System.out and various logging frameworks, but they are also tedious to use in this case. Instead of writing log statements everywhere in my codebase, I just need to know which methods/LOC are being called. Commented Jun 20, 2016 at 20:41
  • AspectJ could help you: stackoverflow.com/questions/12732069/… Commented Jun 20, 2016 at 20:43
  • First off, you should already have log messages being pushed out. Secondly , the way you describe it, no it's not possible. If you want to know which methods are being called as a normal user without debugging then logs are you only choice because breakpoints won't exist. Commented Jun 20, 2016 at 20:56

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.