I'd also be interested in seeing some published best practices. For now here's my rule-of-thumb
FATAL - Stuff that is catastrophic enough to warrant escalation back to the developers for thorough investigation and root-cause analysis. ERROR - Stuff that should be investigated. Don't log something as an error unless you are willing to investigate it yourself. WARN - Stuff someone reading the log really needs to pay attention to. Something you may want to consider investigating. INFO - Stuff you want to see from logs of your product at a customer site to help in troubleshooting an issue. You'll want to be able to save anywhere from a day's to a week's worth of logs. DEBUG - Not enabled by default for released product. Enabled for general development and prerelease testing. Stuff you want to see to help you during the development process. You'll want to save at least a day's worth of logs. TRACE - Not ever enabled by default. Used during code development to help understand how things are working. Can produce volumes of output. Should only be enabled for specific packages, not the whole product. You'll want to save at least an hour's worth of logs. One of the big problems with reading logs is "burn out" - seeing too much stuff logged at too high a priority. If your log contains 10% ERRORs people grow numb and don't take things seriously. Cheers, Eric -----Original Message----- From: Jason Irwin [mailto:[EMAIL PROTECTED] Sent: Friday, February 29, 2008 1:38 AM To: [email protected] Subject: Logging Best Practice? I've been doing a fair bit of trawling around logging for some best practice on logging. Does anyone know of a good resource? Or a book which goes into detail on this? The levels FATAL and ERROR are pretty self-explanatory. Are there rules of thumb for INFO, WARN, DEBUG and TRACE? Common metrics for the amount of debugging per class? What should be logged (e.g. parameter values when entering a method to DEBUG; or something) The nature of the logged information (e.g. class, file, method - or not) We already have a lot of logging in our application, but we only make use of ERROR and DEBUG levels and I am concerned we are not being as pragmatic as we should be with what we are logging. My feeling is that we under-log some information which would help the Support team, and over-log a lot of irrelevant stuff. I'd like to be able to back this feeling up. Cheers for any advice, J. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
