IBM i e-Book
A Developer’s Guide to Mastering IBM i Concepts
IBM i Index
Jobs & Logs
System Logs
IBM i has two types of logs for messages. They are:
- Job log – Log generated for any job on the system, whether it could be interactive or submitted batch job, is called a job log.
- History log/System log – Whenever a system activity is successful or abended with some error, a message will be generated by the system. All such messages can be viewed at History log (System Log). Message can be associated with a job/system/device status or a system operator message.
How to view the System log?
- DSPLOG command can be used to see the system log.
Note: Since the result is read only, it is safe to run this command in ALL environments.
Command:
Result:
To see the additional information, take F1 on corresponding message.
Parameters:
On typing the command and taking prompt (F4), corresponding parameters can be seen.
Log: The only option available for this parameter is QHST, which means system history log.
Time Period: This parameter can be used to view the system log for a certain period. Beginning Time/Date and Ending Time/Date can be input for corresponding time frame.
Time should be specified in 24-hour format and date should be specified in the date format the current job uses.
For example, the input below gives the system log between 1 PM and 3 PM for the current date.
Output: This parameter has four options.
* – Result will be shown on the display.
*PRINT – Spool file will be generated for the output. Only the first 105 characters of first
level message text will be printed for each message.
*PRTWRAP – Spool file will be generated for the output. Up to 2000 characters of first
level message text will be printed for each message.
*PRTSECLVL – Spool file will be generated for the output. Up to 2000 characters of first
level message text and 6000 characters of second level message text will be printed for each message.
Additional Parameters: After taking prompt(F4) on the command, press F10 for additional parameters and move the page down to input the additional parameters.
Job: This parameter can be used to see the system log associated to specific job or specific user.
For example, the below input gives the system log associated to the user SUPERUSER.
Message Identifier: This parameter can be used in two ways.
*ALL – All messages irrespective of message identifiers, will be included in the output.
Specific/Generic – If looking for specific message then corresponding message identifier can be input. If looking for certain message types, then generic format can be input.
For example, to see the job started messages CPF1124 can be input.
Message Identifier Selection: This parameter is associated with Message Identifier and can be used in two ways.
*INCLUDE – All the messages as per the Message Identifier input, will be included in the output.
*OMIT – All the messages as per the Message Identifier input, will be excluded in the output.
For example, to exclude the job started messages input CPF1124 in Message Identifier and *OMIT in the selection.
Benefits of System log:
- To know the start/end time of a job from the past.
Let us assume that a job is scheduled in production to run on daily basis; and start/end time is needed to present in the daily dashboard. In some cases, timelines are needed from the past. So, DSPLOG command can be used with Job name, date, message identifiers as CPF1124/CPF1164 and selection as *INCLUDE to know the timelines.
- To analyze the production issue.
Let us assume that an issue is reported in production, which could be a run-time exception. If you know the exact job which caused the issue, then you can check the job log and find the root cause. If no job details are available, then DSPLOG command can be executed with the suspected time frame and check for exception message. Take F1 on message and then F9 to know the exact job/program & analyze the issue.
Hence, System Log provides useful information and can be used in many scenarios whenever needed.