The Joy Of Cryptic Log Messages

*I* understand the log message, and that’s good enough. After all, I’m the only one that can fix it.
 — #CowboyDeveloper
Here’s a thing that actually happened in my past (details of the story changed to protect the guilty parties)
One of my developers, call her Alice, got assigned an issue (accompanied by a sinister laugh. I can vouch for this). She started analyzing it, and discovered — with sinking heart — that it was in a component built by one of the resident #CowboyDevelopers (•). What’s worse is that when she replicated the issue, the component crapped out a log message that kinda looked like Heap count out of scope.
So, the funny thing here is that the component actually doesn’t have any Heaps in it. And this wasn’t about the memory either — the log was being thrown by, essentially, the following
if self.count == 19:
    return self
else:
    print "Heap count out of scope"
Anyhow, Alice eventually figured out that
• This particular object collected entries that needed to be processed.
• The entries were not ordered so the #CowboyDeveloper called it a “Heap” (“you know, because it’s like a Heap of things. Like on my desk.”) (••)
• There could never, ever, be more than 18 items, so if self.count, ever got to 19, was out of scope (•••)
• And yeah, in a recent tweak, the entry count had been raised to 19, and hence, the log message.
The thing is, if Alice blew the best part of a day tracking this down. If she had asked the #CowboyDeveloper early on, he’d probably have known right off the bat what the issue was, and have fixed it in a few minutes.
And that would have been bad.
Why? Because he’d probably have swapped in if self.count == 20:, causing the whole damn thing to crash a few weeks later when the entry count was raised to 24. The stupid log was the impetus for a wholesale refactoring of the component (••••), and this was far, far from being one of the dumbest things we found in the code.
In case you’re wondering, the point here is that you should look at cryptic log messages as opportunities. If you see messages that don’t make sense, then,
  1. 1. You might not understand the code in question — an opportunity to learn up on what’s going on
  2. 2. The message might not be descriptive enough — an opportunity to fix the situation, both for your, and future generation’s, sake
  3. 3. The message might be wrong — also an opportunity to fix the situation
  4. 4. The message might not even have the virtue of being wrong (as above) — in which case you have a pleasant refactoring in store.
In all cases, there is something that needs to happen. You may not want to do it, but hey, at least now it’s there in the open!
/via http://www.commitstrip.com/en/2018/05/09/progress/
(•) I inherited these chumps. And no, I couldn’t get rid of them because…politics.
(••) And yes, the irony that he called it a Heap was entirely lost on him
(•••) If you guessed that there was an argument insisting that this didn’t need to be self.count >= 19, then you guessed right.
(••••) Much KickingAndScreaming™ in opposition by the #CowboyDeveloper, in case you’re wondering

Comments

Popular posts from this blog

Erlang, Binaries, and Garbage Collection (Sigh)

Cannonball Tree!

Visualizing Prime Numbers