A good program should log every pertinant piece of information,
working directories, parameters passed on the command line, start times
end times, files read from/written to, etc. The log should be very
friendly to the eyes, and work well with tools such as grep.
A good log will have, lots of space between log sections, obvious signs of positive or
negative results, meaningful error messages, clearly understandable
tags, etc.
For example, this is the log of an FTP program that I wrote:
(PS -it was decided that end times would not be all that helpful in this case)
Date: Tue Aug 6 04:00:00 Ping test results: Working Using Firewall: xxx.xxxxxxx.com GEIS ID: 12:?????????? +1 File: /opt/somedir/data/xxx/xxx.2002_08_06.04.00.00 Date: Tue Aug 6 04:25:01 Ping test results: Working Using Firewall: xxx.xxxxx.com GEIS ID: ZZ:?????????? -No file to download. Date: Tue Aug 6 04:25:01 Ping test results: Working Using Firewall: xxx.xxxxx.com GEIS ID: ZZ:?????????? -[!!!]Download failed[!!!] check /opt/somedir/detailedLog for details.
Scanning through this file for errors is easy, visually the
individual entries are short, time stamped and each major
piece of the processing has an individual line in the report.
Additionally successful downloads are marked with a "+",
No data to download is marked with a "-", and errors are
marked with "!!!". These prepended characters, "+" "-" "!!!",
All work with grep pretty well. After a long weekend, with three
of four days of logs to go through, I'll just grep !!! logfile
to quickly get caught up with my log reading.
In reply to Re: Defensive Programming and Audit Trails
by cybear
in thread Defensive Programming and Audit Trails
by FoxtrotUniform
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |