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.

About David:
David is a Principal Software Engineer for PTC, Integrity Business Unit. He cut his teeth on the S/36 and has more than 25 years of experience on the IBM i / System i / iSeries / AS400. He primarily works in Java and ILE RPG specializing in cross platform integrations. David has received the COMMON Distinguished Service award and was named an IBM Power Systems Champion. David is an active volunteer with the American Diabetes Association's Tour de Cure fundraising bike ride. He is currently captain of Team RED Chicago. David runs and maintains midrange.com. His personal blog is Geeky Ramblings.