Any reason not to always log stack traces?

Posted by Chris Knight on Stack Overflow See other posts from Stack Overflow or by Chris Knight
Published on 2010-03-25T22:19:25Z Indexed on 2010/03/25 22:23 UTC
Read the original article Hit count: 281

Encountered a frustrating problem in our application today which came down to an ArrayIndexOutOfBounds exception being thrown. The exception's type was just about all that was logged which is fairly useless (but, oh dear legacy app, we still love you, mostly). I've redeployed the application with a change which logs the stack trace on exception handling (and immediately found the root cause of the problem) and wondered why no one else did this before. Do you generally log the stack trace and is there any reason you wouldn't do this?

Bonus points if you can explain (why, not how) the rationale behind having to jump hoops in java to get a string representation of a stack trace!

© Stack Overflow or respective owner

Related posts about java

Related posts about stacktrace