Lazy logger levels

Developers are lazy guys. They tend to make their lifes easier. I do it everyday. I never miss an opportunity to write a shell script or a shell bit instead of renaming 10+ files. Even when I know it will take exactly the same time as for the manual approach.

Every software piece in the world, I hope, have some decent logging. Those stacks offer various logging levels, such as debug, info, warn, error, and fatal taking Ruby on Rails as an example. And they usually default to info logging setting. Everything "above" info, including, is written in logs.

Now, question. What will a developer like me do, when he needs to write a debug information to the log. The proper way is to set the default logging level to debug or something, restart the application if needed, and use debug call to do it. Good approach, bad answer. He will use info for that. It's simple. It's fast.

And the codebase starts to fill with lots of info statements, the log is being filled with various messages. Administrators do not like it.


Speaking about Ruby on Rails logging, I miss a "trace" logging level so much. Having just one debug tier is simply not enough. Sometimes you want to insert some very low-level statements that could fill the log very easily. If you use debug level, it's not a good idea to commit those changes, because it can bite others. So in Rails the only way is to delete those statements after debugging is done. But wait! The work was already done and maybe someone will need it in the future. That's why trace level should be there. Log4j has it, Rails does not.

Let's read Rails devs opinion on that topic: https://github.com/rails/rails/issues/4756
30 January 2012 | ruby | rails | logging
twitter.com linkedin.com
google.com/+ facebook.com
flickr.com youtube.com