Missing Stackrace in Exception on Java

Asked By 110 points N/A Posted on -
qa-featured

Hi, sometimes when I run my Java code, I get some exceptions but no stacktrace. I have encountered these even in debug mode. Does anyone know what I might be doing wrong?

 

SHARE
Best Answer by Ricky
Answered By 0 points N/A #86136

Missing Stackrace in Exception on Java

qa-featured

Deepa,

If you are using log4j and printing the error as log.error(exception), this will not print the stack trace. Instead use log.error(“some message”, exception).

 

Answered By 110 points N/A #86137

Missing Stackrace in Exception on Java

qa-featured

Ricky,

Thanks for the response. I am using log.error (“some message”, exception) but I still don’t see the stacktrace. What do I do next?

Best Answer
Best Answer
Answered By 0 points N/A #86138

Missing Stackrace in Exception on Java

qa-featured

Deepa, please use the following JVM option:

-XX:-OmitStackTraceInFastThrow

This should help.

Answered By 110 points N/A #86139

Missing Stackrace in Exception on Java

qa-featured

Thanks Ajay. This did the trick.

Login/Register to Answer

Related Questions