8.4. Log Files, Bug Reports, and Collecting Data

Before you start debugging something, go through and collect all the data that you can that shows the symptoms of the thing you're going to fix. Look in the relevant log files, check for any bug reports that may have been created, and write up a series of steps that can reliably reproduce the issue.

Stack traces are really helpful since they often tell you exactly what line the error stopped on. Sometimes that's the line that needs to be fixed, but it's more likely that the line is just a symptom of the problem and not the problem itself.

Sometimes it's good to ask yourself, "What's changed since I last touched this bit of code that might have caused these issues?" That's not always a good question, though. Sometimes something totally unrelated changed and that change caused this bug to reveal itself--the bug was always there, it was just hidden.