Styles of Logging
For progress thru a program or batch job, a simple write to a file works well. The record should have the name of the program, like CC2LOOK, the mode, the time of day and the date, the clerk, and any info particularly interesting to the kind of program. Often a library routine with a few persistent arguments handles this function.
For changes to a record in a data base table, there are common styles
For progress thru a program or batch job, a simple write to a file works well. The record should have the name of the program, like CC2LOOK, the mode, the time of day and the date, the clerk, and any info particularly interesting to the kind of program. Often a library routine with a few persistent arguments handles this function.
For changes to a record in a data base table, there are common styles
- After determining an actual change is pending, the program writes the original record to a another data table or even another data base of log tables. The change is calculated later by comparing the current value of the record to the most recent log record with the matching keys. The time of the change is on the original record. If six changes happen, then six log records exist plus the record in the original table.
- This style becomes tricky in two cases. If the program deletes a record, the program writes the old record to the log table and nothing exists in the original table. The delete is inferred for lack of a record in the origin table. The snarl increases when trying to track inserts. If the program does not write a log record, the auditor can still infer that the insert occurred, but when an insert follows a delete, the action looks like a change and not like a delete followed by an insert. Always writing a record to the log file eliminates this confusion. When the last log record matches the current record, an insert occurred at the date and time of the log record (or the original record).
- The second style writes the current record plus some fields to identify the program and clerk making the changes. Hence the log record is longer than the original data record. In practice, this only duplicates the times and clerks.