![]() | |
|
Logging modes
Two modes of logging and tracing exist in WebSphere Application Server V8.5:
Basic mode
The default mode, is the existing log and trace framework from prior releases of WebSphere Application Server.
High Performance Extensible Logging (HPEL) mode
This is a new log and trace framework. HPEL mode must be explicitly enabled. After HPEL
mode is enabled, the JVM logs (typically SystemOut.log
and SystemErr.log
), the trace log
(typically trace.log
), and the service log (typically activity.log
) are no longer written to.
Instead, log and trace content is written to a log data or trace data repository in a
proprietary binary format. If configured to do so, this content can also be written to a text
log file. Text log file names have the following format: TextLog_<yy.mm.dd>_<hh.mm.ss>
,
where "TextLog_
" is a fixed prefix, <yy.mm.dd>
is a date (year, month, date) of
the first record in the file, and <hh.mm.ss>
is the time (hour, minute, second).
Example: TextLog_14.07.16_09.02.09.log
Disabling the writing of this same text log file results in the largest possible performance
benefit of HPEL. A log viewing tool, logViewer.sh
, is provided to allow for viewing, filtering,
monitoring, and formatting the log and trace data in the repositories.
Figure below shows the files used by the basic mode and HPEL mode log and trace facilities.
When enabled, the HPEL text log file stores content from Java trace (optional), Java logs,
System.out
, and System.err
. You can disable the HPEL text log in cases where it is not
needed as indicated by the dotted lines.
LogViewer command-line tool
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.
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:
(Windows) logViewer.bat
(Unix- full profile) logViewer.sh
(Unix- Liberty profile) logViewer
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 [integer]
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 after 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 z
format. With z
referring to the timezone.
-stopDate date_time
Use this parameter to filter out log entries that occurred before 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_name
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_name
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 instance_id
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.
-includeExtensions name[=value][,name[=value]]*
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 the requested value. You 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.
See the following examples of LogViewer commands used with full profile servers 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 after September 14th, 2011 2:28 PM eastern daylight time:
logViewer.sh -startDate "09/14/2011 14:28:00:000 EDT"
Write events from the default repository that contain 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
![]() ![]() ![]() |