I'm now building a program that is a eBook manager, reader, organizer and publisher, that is also a eBook transfer(to eReaders like Kindle), but I was developing it and a question have poped-up on my mind: "Log or not?"
Then I started to think about logging. As many programs log actions, I started to seek for they and see how they log things, then I want to know:
It's essential. Log
If you get this right, you may find you spend less and less time in the debugger.
I would err on logging more rather than little, and removing or filtering if/when this becomes a problem (as noted below, logging Gbs per day is probably counterproductive). I've worked on numerous systems where it's been decreed that logging will be turned down or removed post development, and this never occurs, since it's so useful. Some people object to logging on the basis that it affects performance. If this is the case, remove it when it's known to be a problem, not before.
You should be able to find suitable frameworks for logging (e.g. log4c for C, log4j for Java) for your particular platform that allow appropriate filtering and destination selection. That means you can log to files (and restrict log sizes), databases, remote monitors etc. and change this decision on the fly (via a configuration file or command-line arguments). The right framework should require very little initially other than your inserting appropriate logging statements. You shouldn't have to write much in the way of file management or other log management code.
Here's a useful blog entry on this subject, with further guidelines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With