Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What resources are available to convince a developer that Java stack traces are worth logging

I've just landed in a new code base. While working to make the application run locally, I noticed I was just getting one-liners for errors in the log and console output - no stack traces. I started searching code and the only thing I could find logged was the exception message. Ditto for "chaining" exceptions: only the message was being retained. I mentioned this to the project's sole developer and asked if it was an intentional design decision. The reply was, in part, "I don't think we'd gain much from [logging stack traces]."

From years of Java development, I know how valuable stack traces are: they tell you which line the exception happened on and you can track how you got there. You read the stack trace and the relevant code and that's probably enough to solve 80% (N.B.: statistic has no statistical backing) of errors you encounter.

I'm not looking for arguments about what to log or when - that's not the question, and it's been covered elsewhere. Really, this just seems like such a fundamental thing to me that I never thought of how to explain it other than that "strack traces show you where the error was." I was hoping I could quickly find a quote from Effective Java or the like, but Google hasn't turned up anything so far.

Any suggestions of authoritative, convincing sources for descriptions of why you should pay attention to stack traces?

like image 922
Isaac Truett Avatar asked Dec 22 '22 17:12

Isaac Truett


1 Answers

Create an intentional error in the code base and make him track it down :-). Seriously, you have good arguments, if you could just demonstrate how much it helps and how much time it saves when tracking down a bug.

like image 119
mellamokb Avatar answered Dec 24 '22 05:12

mellamokb