Log File Diagnostics

Quick tip: When you are logging information for diagnostic purposes … make sure you include some information that allows you to correlate transactions to user or system actions.

For instance: When I log information in my java based application server, I always include the invoking job id in the log entry (999999/USERID/JOBNAME) … that way you can tie it back to to a user job if necessary. Including the task identifier also will help a lot.

While you’re at it, take a look at the messages you are logging … make sure you have enough information to make the message worthwhile … logging “Invalid identifier” is pretty much worthless.

Logging “create-new-item (999999/USERID/JOBNAME) : Invalid identifier XYZ123” is much more helpful.

FWIW: This doesn’t just apply to applications running on IBM i … you should always include some information in the log that indicates the source of the transaction (even if it’s just an IP address). Ideally you would include the user’s id and the ip address they initiated the transaction from.