Member-only story
How to Log
How I learned to log exactly the right things and nothing more.
Not a Medium Member? Read here for free.
Logging is something that every developer should do, though it’s hard to find the right balance and not overdo it. That’s why I want to share my learning in this regard. So here are the two mistakes I made along the way in finding the perfect balance.

1. Not Logging at All
The Mistake: “Nothing can go wrong with my code”, is what a younger me thought sometimes. Little did I know about all the things that can go wrong. Logging was just something that cluttered my code or I had to do it because a senior developer told me to. Without a deeper explanation of why I had to do it, it was just some absurd rule I had to follow. I just hadn’t had the experience yet. It wasn’t until I had to troubleshoot production issues, that I realized what difference good logging can make.
Learning: Logging can save a lot of time and nerves. Troubleshooting will be a lot easier when you log all the relevant information to reproduce the issue. But make sure not to fall in for the next mistake!
2. Overlogging
The Mistake: So “not logging” is an issue, then I’ll make sure that I don’t miss any information that could be relevant at…