View the service log
Service logs are logs written in a binary format. We cannot view a service log directly using a text editor. You should never directly edit the service log, as doing so will corrupt the log.
To move a service log from one machine to another, use a mechanism like FTP, which supports binary file transfer. Use the Showlog tool to convert the contents of the service log to a text format that we can then write to a file or dump to the command shell window.
We can view a service log using the Showlog tool to convert the contents of the service log to a text format that we can then write to a file or dump to the command shell window.
Run the showlog script to view the contents of the service log as described in the following procedure.
- Open a shell window on the machine where the service log resides.
- Change the directory to app_server_root/bin where app_server_root is the fully qualified path where the WAS product is installed.
- Run the showlog script.
showlog.bat
showlog.sh
showlog
Use the following format:
showlog.sh {-start startDateTime [-end endDateTime] | -interval interval} [-format CBE-XML-1.0.1] [-encoding encoding] logStreamName [outputFilename]
where:
- -start
- Start date and time, in yyyy-MM-ddTHH:mm:ss.SSSZ format. Milliseconds and time zone are optional.
- -end
- End date and time, in yyyy-MM-ddTHH:mm:ss.SSSZ format. Milliseconds and time zone are optional.
- -interval
- Start date as the system date and time minus interval milliseconds, and end date as the system date and time. Valid values are integers greater than 0.
- -format
- Specifies the output format. Currently only CBE-XML-1.0.1 format is supported (this complies with the Common Base Event specification version 1.0.1). If no format is given, showlog outputs in a tabular format.
- -encoding
- Specifies the output file encoding, a character encoding supported by the local Java Virtual Machine .
- logStreamName
- Is a log file name.
- outputFilename
- Is optional. If no file name is given, the showlog script creates a default showlog.out filename, outputFilename is created in the current directory unless it is a fully qualified file name.
The formatted contents of the service log are always written to a file. There are parameters to showlog.sh which control content and encoding of the output. Enter showlog.sh without parameters for parameter usage information.
The showlog script can return informational messages containing service names, return codes, and reason codes. For more information about using the z/OS log stream, or to look up service names, return codes, and reason codes, refer to z/OS MVS™ Authorized Assembler Services Reference ENF-IXG(SA22-7610). Return and reason codes are listed for each service.
Refer to the topic "Authorization for System Logger Application Programs" in z/OS MVS Assembler Services Guide (SA22-7605) for advice on permitting access to the log stream.
- Run the following showlog script with no parameters to display usage instructions.
showlog.bat
showlog.sh
showlog
showlog.sh
- Display the service log contents to the shell window.
showlog service_log_filename
If the service log is not in the default location, you must fully qualify the service_log_filename
- Format and write the service log contents to a file.
showlog service_log_filename output_filename
If the service log is not in the default location, you must fully qualify the service_log_filename
Example
Here are examples of showlog scripts on z/OS systems
- To write all records from the WAS.ERROR.LOG file since July 14, 2004 in log analyzer format into the myoutput.log file, use the following format:
showlog.sh -start 2004-07-14T00:00:00 WAS.ERROR.LOG myoutput.log
- To write all records from WAS.ERROR.LOG file since July 14, 2004 in Common Base Event XML 1.0.1 format into myoutput.log file, use the following format:
showlog.sh -start 2004-07-14T00:00:00 -format CBE-XML-1.0.1 WAS.ERROR.LOG myoutput.log
- To write all records from WAS.ERROR.LOG file between July 14, 2004 and April 9, 2005 in Common Base Event XML 1.0.1 format into myoutput.log file, use the following format:
showlog.sh -start 2004-07-14T00:00:00 -end 2005-04-09T00:00:00 -format CBE-XML-1.0.1 WAS.ERROR.LOG myoutput.log
- To write all records from WAS.ERROR.LOG file since December 6, 2004 at 9pm Eastern standard time into myoutput.log file (the default output file), use the following format:
showlog.sh -start 2004-12-06T21:00:00EST WAS.ERROR.LOG
Subtopics
- Generating messages in Common Base Event format
Use the administrative console to enable writing of the logstream in Common Base Event format.
- Logstream size considerations
We might need to modify the size of the logstream record size if the application server is attempting to write messages that are too large. If a message is too large, you will receive an error message that will be written to the job log.
Showlog commands for Common Base Events