Editorial note: I originally wrote this post for the LogEntries blog. You can check out the original here, at their site. While you’re there, sign up for the service and check it out.
It seems almost strange to talk about avoiding things while logging. After all, logging is your last line of defense or your salvation in many cases. Some crazy bug in the field that shows up every third full moon? An external auditor looking at your app’s runtime behavior? Logging to the rescue.
So naturally, is stands to reason that you would want to log just about everything your application. Whenever there’s any doubt, slam a logger call in there and let log level sort out the details. You can always filter logs, but you can’t magic stuff into them after the fact. So why, then, talk of avoidance?
Well, it turns out that, while logging may be a highly inclusive activity in terms of what should be included, there are ways to create problems. You want to be liberal in terms of what you log, but judicious and wise in terms of how you log it. You don’t want to indulge in a feckless free-for-all when it comes to the calls you make to your application’s logger.
So what are these problems, and how to avoid them? Let’s take a look at some things that can come back to bite you.