Custom error reporting: how to log down function arguments (and possibly locals) in an exception handler?

80 views Asked by At

I'd like to write a generic exception handler that would report not only the exception and stacktrace, but also function arguments for all the functions in the stacktrace. If it would be possible for locals and this object as well, it would be just awesome. I'm thinking of writing my own some-kind-of poor man's Takipi. How could I achieve this?

1

There are 1 answers

0
jmehrens On

One way would be to use the Java Debug Interface to capture function arguments, this, and locals for all the functions in the stacktrace. It requires launching the JVM with the debugger on.

Otherwise, you could use instrumentation agents to modify the byte codes of methods to capture the information for use in your exception handler.