Use the LogViewer command to query the contents of the
High Performance Extensible Logging (HPEL) log and trace repositories.
You can also use the LogViewer command to view new log and trace repository
entries as the server writes content to them.
LogViewer
The
High Performance Extensible Logging (HPEL) facility writes to the
log and trace repositories in a binary format. You can view, query
and filter the repository using the LogViewer command. The LogViewer
command provides options for quickly converting HPEL logs into a text
file in various formats, including basic, advanced, and Common Base
Event format. The command also provides options to make getting the
data you need from the logs easier; for example, allowing you to filter
what log records you want by level, logger name, or date and time.
Use the following command to view
the full contents of your log and trace repositories:
Optional
parameters
- -repositoryDir directory_name
- Specifies the path to the repository directory. In the case where
you want to query both the log and trace data together, provide the
path to the parent directory, which contains both the log data and
tracedata directories. If you 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, you are prompted
to select which server log and trace repository you want to view.
- -outLog file_name
- Specifies the file name you want the text output written to. If
you do not provide this information, the text output is displayed
on the console.
- -format basic
| advanced | cbe-1.0.1
- Specifies the output format. Supported formats include basic,
advanced, and the CBE-1.0.1 format. If you do not provide this information,
the output is in basic format.
- -monitor [interval]
- Specifies that you want the logViewer to continuously monitor
the repository and output new log record entries as they are created.
You can provide an optional integer argument after this parameter
to specify how often you want the LogViewer tool to query the repository
for new records. By default the logViewer queries the repository for
new records every 5 seconds. When used with other filtering options,
only those new records that match the filter criteria are displayed.
- -help
- Use this parameter to have the LogViewer tool list the full set
of options that are available.
- -startDate date_time
- You can filter the results that are displayed from the repository
by date and time. Use the startDate parameter to filter out log entries
that occurred before the date or date time provided as an argument.
Provide either a date or date and time, entered in the MM/dd/yy format
or the MM/dd/yy H:m:s:S format.
- -stopDate date_time
- Use this parameter to filter out log entries that occurred after
the specified date or date time. Provide the argument in the same
format as the -startDate option.
- -level level_name
- Specifies that you want the tool to only display those log events
which match the level name you provide as an argument. Valid values
for the level name are FINEST, FINER, FINE, DETAIL, CONFIG, INFO,
AUDIT, WARNING, SEVERE, FATAL.
- -minLevel level_name
- Specifies that you want the tool to only display records which
are at or above the specified level. Valid values for the level name
are FINEST, FINER, FINE, DETAIL, CONFIG, INFO, AUDIT, WARNING, SEVERE,
FATAL.
- -maxLevel level_name
- Specifies that you want the tool to only display records that
are at or below the specified level. Valid values for the level name
are FINEST, FINER, FINE, DETAIL, CONFIG, INFO, AUDIT, WARNING, SEVERE,
FATAL.
- -includeLoggers logger_names
- When this option is used, 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 the -excludedLoggers
option, the more specific match determines if the log event is included
or excluded.
- -excludeLoggers logger_names
- Use this option to 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 the -includeLoggers option,
the more specific match determines if the log event is included or
excluded.
- -thread thread_ID
- Use this option to restrict LogViewer output to only those log
events from a specific thread. Any log messages that were not created
by the thread ID provided as an argument to this option are not displayed.
Specify the thread ID in hex format.
- -extractToNewRepository directory_name
- This option redirects log and trace records from a binary repository
to a new binary repository at the location that you specify. You can
use this option with other filtering options to get a subset of log
and trace records into the new repository. This option uses the 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
- Use this option to list the IDs of available server process instances
that are available to use with the -instance option. After running
LogViewer with the -listInstances option, you can then use the -instance
option to invoke LogViewer with one of the server process instance
IDs as an argument. Since this option does not process any log or
trace records, all other options are ignored when you specify this
option.
- -instance instanceId
- Use this option to retrieve the log and
trace data for a given server process instance by providing the server
instance ID. Run LogViewer, along with the -listInstances option,
before you use this option to obtain a valid instance ID. This option
is required when viewing logs and trace from an environment that contains
subprocesses, such as the z/OS® operating
system.
- If this option is combined with -latestInstance,
-instance is ignored.
- -latestInstance
- Use this option to retrieve the 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
- Use this option to retrieve only log or trace data with a message
field that matches the requested text.
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
Example usage
See the following examples of LogViewer commands on UNIX-based
systems. The examples show how to run LogViewer from the profile bin
directory where the repositoryDir parameter is not required.
- 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"