0

How can we debug what happened when an exception was thrown at a later time?

We've got a production app written in Java that randomly throws an exception, which we can catch and log on the server. We'd like to debug this to see what's happening, as the logs aren't revealing much information.

And by debug I mean step into a debugger like Eclipse or IntelliJ's debugger and walk through the code for what happened when the exception was thrown, complete with data being passed to methods and local variables, etc.

So I'd like to have a dump of some sort saved whenever this happens, and then be able to load that dump in some tool to debug it after the fact.

So I'd prefer solutions that:

  • Can create a dump file from code without adversely affecting our production app
  • Can be analyzed using a GUI tool like Eclipse's debugger, for example.
2
  • 2
    You will always have adverse effects, as something must either run additionally in memory, or write something to hard disk all the time, or both. Have you had a look into Oracle's JVM Flight Recorder? oracle.com/technetwork/java/javaseproducts/mission-control/… Commented Oct 11, 2016 at 14:14
  • Good mention on JVM Flight Recorder - you should add that as an answer! Commented Oct 11, 2016 at 21:42

1 Answer 1

1

I recommend having a look into Oracle's JVM Flight Recorder, which is not free, but exactly for this scenario.

http://www.oracle.com/technetwork/java/javaseproducts/mission-control/java-mission-control-1998576.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.