Viewing the service log

Service logs are logs written in a binary format. You 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.

Before you begin

[AIX Solaris HP-UX Linux Windows][IBM i]To move a service log from one machine to another, you must 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 you can then write to a file or dump to the command shell window.

[z/OS]You can view a service log using the Showlog tool to convert the contents of the service log to a text format that you can then write to a file or dump to the command shell window.

About this task

Run the showlog script to view the contents of the service log as described in the following procedure.

Procedure

  1. Open a shell window on the machine where the service log resides.
  2. Change the directory to app_server_root/bin where app_server_root is the fully qualified path where the WebSphere Application Server product is installed.
  3. Run the showlog script.

    [Windows]showlog.bat

    [Linux][AIX][HP-UX][Solaris]showlog.sh

    [IBM i]showlog

    [z/OS]Use the following format:
    showlog.sh {-start startDateTime [-end endDateTime] | -interval interval} 
    [-format CBE-XML-1.0.1] [-encoding encoding] logStreamName 
    [outputFilename]
    where:
    -start
    Specifies the start date and time, in yyyy-MM-ddTHH:mm:ss.SSSZ format. Milliseconds and time zone are optional.
    -end
    Specifies the end date and time, in yyyy-MM-ddTHH:mm:ss.SSSZ format. Milliseconds and time zone are optional.
    -interval
    Specifies the 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.

    [z/OS]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.

    [z/OS]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.

    [z/OS]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.

  4. Run the following showlog script with no parameters to display usage instructions.

    [Windows]showlog.bat

    [Linux][AIX][HP-UX][Solaris]showlog.sh

    [IBM i]showlog

    [z/OS]showlog.sh

  5. [AIX Solaris HP-UX Linux Windows] 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

  6. 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

[z/OS]

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