LogViewer command-line tool
Use the LogViewer command to query the contents of the HPEL log and trace repositories.
LogViewer
logViewer.sh converts HPEL-formatted logs into text file formats...
- basic
- advanced
- and Common Base Event
Log records can be filtered by level, logger name, or date and time.
Parameters
- -repositoryDir directory_name
- Path to the repository directory. To query log and trace data together, provide path to parent directory, which contains both the log data and trace data directories. If we use the default repository location...
profile_root/logs/application_server/
...and run this tool from the profile bin directory, then this argument is optional. The tool checks the default location if one is not provided. If multiple application servers exist in this profile with HPEL repositories, we are prompted to select which server log and trace repository to view.
- -outLog file_name
- File name you want the text output written to. If not provided, the text output is displayed on the console.
- -format basic | advanced | cbe-1.0.1
- Output format. Supported formats include basic, advanced, and the CBE-1.0.1 format. If not provided, the output is in basic format.
- -monitor [integer]
- Continuously monitor the repository and output new log record entries as they are created. Provide optional integer argument to specify how often to query for new records. Default is every 5 seconds.
- -help
- List the full set of options available.
- -startDatedate_time
- Filter log entries that occurred before the specified date or date time. MM/dd/yy format or MM/dd/yy H:m:s:S format.
- -stopDate date_time
- Filter log entries that occurred after the specified date or date time. MM/dd/yy format or MM/dd/yy H:m:s:S format.
- -level level_name
- Display log events that match level. Valid values are FINEST, FINER, FINE, DETAIL, CONFIG, INFO, AUDIT, WARNING, SEVERE, FATAL.
- -minLevel level_name
- Display records at or above the specified level. Valid values are FINEST, FINER, FINE, DETAIL, CONFIG, INFO, AUDIT, WARNING, SEVERE, FATAL.
- -maxLevel level_name
- Display records at or below the specified level. Valid values are FINEST, FINER, FINE, DETAIL, CONFIG, INFO, AUDIT, WARNING, SEVERE, FATAL.
- -includeLoggers logger_name
- Only log events from the specified loggers are included in the LogViewer output. Separate multiple entries with a comma. The * symbol can be used as a wild card to include all loggers below a parent logger. When used in combination with -excludedLoggers, the more specific match determines if the log event is included or excluded.
- -excludeLoggers logger_name
- Exclude log events from the specified loggers in the LogViewer output. Separate multiple entries with a comma. The * symbol can be used as a wildcard to include all loggers below a parent logger. When used in combination with -includeLoggers, the more specific match determines if the log event is included or excluded.
- -thread thread_id
- Restrict LogViewer output to only those log events from a specific thread. Log messages not created by the thread ID not displayed. Specify thread ID in hex format.
- -extractToNewRepositorydirectory_name
- Redirect log and trace records from a binary repository to a new binary repository at the location specified. Can be used to get a subset of log and trace records into the new repository. Uses directory path where the new repository must be written as an argument. Therefore, the directory must be empty. If the directory does not exist, the directory is created. However, errors that occur during the directory creation might create extraneous directories.
- -listInstances
- List IDs of available server process instances available to use with the -instance option. After running LogViewer -listInstances, we can use the -instance option to invoke LogViewer with one of the server process instance IDs as an argument.
- -instance instance_id
- Retrieve log and trace data for a given server process instance by providing the server instance ID. Run LogViewer, -listInstances option, before using. Required.when viewing logs and trace from an environment containing subprocesses, such as the z/OS operating system.
- If this option is combined with -latestInstance, -instance is ignored.
- -latestInstance
- Retrieve log and trace data from the most recent server instance. If this option is used with the -instance option, the -instance option is ignored.
- -message match_string
- Retrieve only log or trace data with a message field that matches the requested text.
- -includeExtensions name[=value][,name[=value]]*
- Retrieve the log and trace data with an extension name that matches the requested name, and an extension value that matches the requested value. We can also use this option to retrieve the log and trace data with an extension name that matches the requested name, and an extension value that matches any value, if you omit the =value part of the option.
- Any extension name shown in the advanced format can be used. Note that 'source', 'class', and 'method' are not stored in the log/trace repositories as extensions, and so cannot be filtered on with this option.
- Separate multiple name=value arguments with a comma. Specify '==' (two equals signs) in place of '=' (one equals sign) in cases where the name or value must contain an equal sign. Specify ',,' (two commas) in place of ',' (one comma) in cases where the name or value must contain a comma.
- -encoding character_set
- Character set the LogViewer command will use for text output.
Filtering considerations
Be aware of LogViewer filtering optimizations. The LogViewer tool is able to filter log and trace data most efficiently when used with the following filter options:
- startDate
- stopDate
- thread
- level
- minLevel
- maxLevel
Examples
- Write all records in the default repository between July 19th, 2009 and August 2nd, 2009 to a file called /tmp/promo.logs.
logViewer.sh -outLog /tmp/promo.logs -startDate 07/19/2009 -stopDate 08/02/2009
- Display new records whose specified level is WARNING or higher using the advanced format as the server writes them to the log repository.
logViewer.sh -monitor -minLevel WARNING -format advanced
- Write only those log messages that were written to the error stream of a specific repository to a file called logged_errors.txt.
logViewer.sh -repositoryDir /apps/server1/logs -includeLoggers SystemErr -outLog logged_errors.txt
- View events from the default repository that occurred before September 14th, 2009 4:28 PM eastern daylight time.
logViewer.sh -stopDate "09/14/2009 16:28:00:000 EDT"
- Write events from the default repository containing a 'thread' extension with value 'WebContainer : 6'
logViewer.sh -includeExtensions thread="WebContainer : 6" -format advanced
- Write events from the default repository that were a part of the request with requestID a856cb2c-79ed-4d62-a3cf-a9908b2db07b.
logViewer.sh -includeExtensions requestID=a856cb2c-79ed-4d62-a3cf-a9908b2db07b
- Write events from the default repository that were created on a thread servicing the PlantsByWebSphere application.
logViewer.sh -includeExtensions appName=PlantsByWebSphere