Reputation: 96716
When using a log facility, what are the common "rules of thumb"? E.g.
Upvotes: 2
Views: 793
Reputation: 82535
Log enough detail about input events that you can run the exact same sequence of events again during debugging/test. However, you have to use some common sense. Logging every mouse-move event is probably overkill unless you have reason to believe that a sequence of mouse-move events will cause an issue.
Upvotes: 0
Reputation: 8157
Upvotes: 0
Reputation: 5043
I agree with Jonathon, more context would be helpful. Some things to think about are:
These are just a few questions to think about.
Upvotes: 2
Reputation: 56113
If you have to discard messages, discard the unimportant ones.
If you're displaying an important message, don't bury it in a flood of unimportant ones.
Make it very cheap to not display a message when that level of messaging is disabled/not needed.
Make it possible to discover the current state of the system without having to read every old message.
Manage the size of your log files (e.g. several files instead of one file of infinite size), beware filling the disk.
Consider using a standard output format/medium (for example SNMP, <small>
or the NT event log</small>
), which you can view and manage using fully-featured 3rd-party tools.
Upvotes: 1
Reputation: 1211
We rate-limit duplicate messages. We use a syslog-like category & priority hierarchy and, by default, only log messages that indicate warnings and above.
If things go south, we can crank up the logging for that component until we've resolved it.
Upvotes: 1
Reputation: 129403
Print as much context on failure as you can. Including fullest error message possible. Include exact location in the program, or in the workflow (e.g. "error processing line 10029 of input file" vs. "error processing input file")
When DB query fails, consider printing the query text nicely formatted (e.g. Sybase errors usually contain mangles partial query only)
Use log facility that has nice formatting, including ability to tag INFO/WARN/ERROR (or level of log message), for easy grepping
Use log facility that has decent timestamps ability.
As you noted, consider volume. Throttle or bundle messages.
Upvotes: 1