Richard Bucker

Logging everything is not the answer

Posted at — Apr 27, 2014

I have long since held the belief that if you’re going to send someone a status email of some kind then whatever alert you’re providing must be actionable. I was reminded of this fact while reading a blog post from a recent gophercon. In the context of the blog post the author suggested that you should not log anything unless it was actionable.That is a very strong statement and so I started to think about it and more practical terms.In one recent project there was very little  test automation. It would be too easy to blame the fluidity of the environment and lack of knowledge of the target to justify not writing any tests. This project was an integration between two systems that were very dynamic. It ended up being realize as a series of code templates and cookie-cutter implementations. In this case I had to log everything. Every entry and exit into an API produced a timestamp in the log file along with a calculated elapsed time. Implementing the trace was not a difficult or expensive operations however it did take up a lot of disk space.Another project I’m working on is it implementation of a flow based framework. There is very little logging at the framework level other than some of the preliminary debugging information. However there are extensive test cases which validate the framework. This implementation is incomplete and will eventually be completely instrumented because part of the benefit of the framework itself is in fact the monitoring of the stages and state of the user application. So while there is not a framework level logging the logging within the framework will blog for the application.