日志和跟踪扩展

应用程序服务器中的高性能可扩展记录 (HPEL) 功能为开发者提供了一种方法,可用于向日志和跟踪记录中添加扩展字段,还提供了一种对应方法,以供用户按照扩展值来过滤日志和跟踪记录。

日志和跟踪记录包含记录的创建时间、记录的消息的内容等等信息的字段。这些字段是核心字段,每个日志和跟踪记录中都存在。相比之下,扩展字段是应用程序开发者可以添加到日志和跟踪记录的字段,在搜索特定日志和跟踪内容时,您可以将扩展字段用作过滤条件。这些日志和跟踪记录扩展在下列情况下在 HPEL 文本记日志中可见:将文本输出格式配置为使用高级格式时;以高级格式使用 LogViewer 命令时。

管理员

应用程序服务器将自动创建一些扩展,您可以使用这些扩展来过滤日志和跟踪记录。还可以使用由应用程序开发者添加的任何扩展来过滤日志和跟踪记录。可以使用 LogViewer 命令行工具根据日志和跟踪记录扩展的内容来过滤记录。

例如,要查看由线程 WebContainer : 6 创建的所有记录,可以使用下列 logViewer 命令:[IBM i]
logViewer -includeExtensions thread="WebContainer : 6" -format advanced
[AIX HP-UX Solaris][Linux]
logViewer.sh -includeExtensions thread="WebContainer : 6" -format advanced
[Windows]
logViewer.bat -includeExtensions thread="WebContainer : 6" -format advanced
[z/OS]
logViewer.sh -instance instance_id -includeExtensions thread="WebContainer : 6" -format advanced
Developers

Developers can use HPEL to add custom extensions to log and trace records through the log record context API, com.ibm.websphere.logging.hpel.LogRecordContext. When HPEL stores log and trace records, it includes any extensions that are present in the log record context on the same thread. For example, you can write a servlet filter to add important HTTP request parameters to the log record context. While that servlet runs, HPEL adds those extensions to any log and trace records that are created on the same thread.

As with other log and trace record fields, developers can access the record extensions by using the HPEL API. This API is useful when you write tools to read from log and trace repositories. Developers can also use the log record context API to access extensions in custom log handlers, filters, and formatters at run time.

The following table describes the log and trace extensions, including the identifier that you can use to filter various aspects of the trace.

表 1. Log and trace extensions. This table lists log and trace extensions available when you use HPEL.
Extension Description
appName

Specifies the name of the Java™ Platform, Enterprise Edition (Java EE) application that the log or trace record relates to, if any.

requestID

Specifies the unique ID of the request that each log or trace record relates to, if any. For the application server to add the requestID extension to log and trace records, you must enable Cross Component Trace (XCT), also referred to in the administrative console as log and trace correlation. Request IDs are only added for certain types of requests, such as HTTP or JMS requests.

SIPCallId

Specifies the SIP call identifier that is being processed by the SIP proxy server or SIP container. This information is common across SIP proxy servers and SIP containers. You can use this extension to track the SIP call flow across the various components. The SIP proxy server and SIP container automatically adds this identifier to each log and trace record when HPEL logging is enabled.

SIPASId

Specifies the SIP application session ID that is being processed by the SIP container. This information is common across SIP containers. You can use this extension to track the SIP call flow. The SIP container automatically adds this identifier to each log and trace record when HPEL logging is enabled.

 SIPSessionId

Specifies the SIP session ID that is being processed by the SIP container. This information is common across SIP containers. You can use this extension to track the SIP call flow. The SIP container automatically adds this identifier to each log and trace record when HPEL logging is enabled.

SIPCallId2

Specifies the second SIP call ID that is associated with the same SIP application session and is being processed by the SIP container. This information is common across SIP containers. You can use this extension to track the SIP call flow. The SIP container automatically adds this identifier to each log and trace record when HPEL logging is enabled.

If more than two SIP call IDs are associated with a single SIP application session, only the first two IDs are recorded. The additional IDs are not recorded.

SIPSessionId2

Specifies the second SIP session ID that is associated with the same SIP application session and is being processed by the SIP container. This information is common across SIP containers. You can use this extension to track the SIP call flow. The SIP container automatically adds this identifier to each log and trace record when HPEL logging is enabled.

If more than two SIP session IDs are associated with a single SIP application session, only the first two IDs are recorded. The additional IDs are not recorded.

thread

Specifies the thread name of the request that each log or trace record relates to.


指示主题类型的图标 参考主题



时间戳记图标 最近一次更新时间: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=rtrb_logtraceextensions
文件名:rtrb_logtraceextensions.html