What do we log and why do we log it?
Posted
by Lucas
on Stack Overflow
See other posts from Stack Overflow
or by Lucas
Published on 2010-04-09T17:48:32Z
Indexed on
2010/04/09
17:53 UTC
Read the original article
Hit count: 280
logging
|language-agnostic
This has been bugging me for quite some time.
Reading various questions on SO, blogs and listening to colleagues, I keep hearing how important "logging" is. How various logging frameworks stack up against each other, and how there are so many to pick from it's (apparently) ridiculous.
Now, I know what logging is. What I don't know is what is supposed to be logged and why. Sure, I can guess. Exceptions? Sounds like something one might want to log... but which exceptions? And is it only exceptions? And what do I do with the logged information? If it's an in-house app, then that could probably be put to good use, but if it's a commercial desktop application, how is the log of... whatever... helping anyone? I doubt regular users would be peeking inside. Is it then something you ask the users to provide on request?
I'm deeply frustrated by my own ignorance in this.
It's also surprising how little information there is about this. The info on the websites of the various logging frameworks is all written for an audience that already knows what it wants to log, and knows why it needs to do so. Same things goes for the various discussions on SO about logging, like for instance this highly voted up question on Logging best practices. For a question with so many votes, it's almost comical how there's next to nothing in there that would answer my what and why questions.
So being finally fed up, I'm asking here: what do people log, and why do they log it?
© Stack Overflow or respective owner