Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting local variables

When getting a stacktrace as error report from an application that is already deployed, it would be helpful to also get the actual variable values to reconstruct the system's state at the point before the exception was thrown.

Is anything like that feasible in Java and how could one do that?

Cheers, Max

like image 350
Max Avatar asked Jan 06 '11 22:01

Max


1 Answers

I'm pretty sure you cannot get the local variables in the stacktrace as the output is built from instance of StackTraceElement which only contains, the class, the file, the method and the line number (see http://download.oracle.com/javase/6/docs/api/java/lang/StackTraceElement.html).

like image 98
gabuzo Avatar answered Oct 12 '22 02:10

gabuzo