Liberty:事件記載

在監視和診斷功能中,WebSphere Application Server Liberty 會針對 Java Platform Enterprise Edition 的不同元件產生事件,以追蹤要求。當正在執行應用程式要求時,eventLogging-1.0 特性會記載這類事件。利用這項特性,使用者就可以追蹤正在 WebSphere Application Server Liberty 中執行的要求。每一項要求都會有一個相關聯的唯一相關性因子(稱為要求 ID)和環境定義資訊,以幫助使用者瞭解要求的特定資料。

事件記載特性是透過伺服器配置來控制。此特性配置在 server.xml 檔中。

下列範例日誌顯示 AAY6TalVDTO_AAAAAAAAAAK 要求 ID 和 TradeWeb 環境定義的端對端事件日誌:
[12/15/14 18:24:29:528 IST] 0000002e EventLogging		I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | TradeScenarioServlet
[12/15/14 18:24:29:531 IST] 0000002e EventLogging		I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | TradeAppServlet
[12/15/14 18:24:29:532 IST] 0000002e EventLogging		I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | /quote.jsp
[12/15/14 18:24:29:533 IST] 0000002e EventLogging		I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | /displayQuote.jsp
[12/15/14 18:24:29:534 IST] 0000002e EventLogging		I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.datasource.psExecuteQuery # contextInfo=jdbc/TradeDataSource | select * from quoteejb q where q.symbol=?
[12/15/14 18:24:29:547 IST] 0000002e EventLogging		I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.datasource.psExecuteQuery # contextInfo=jdbc/TradeDataSource | select * from quoteejb q where q.symbol=? # duration=12.537ms
[12/15/14 18:24:29:556 IST] 0000002e EventLogging		I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | /displayQuote.jsp # duration=22.171ms
[12/15/14 18:24:29:671 IST] 0000002e EventLogging		I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | /displayQuote.jsp
[12/15/14 18:24:29:672 IST] 0000002e EventLogging		I BEGIN requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.datasource.psExecuteQuery # contextInfo=jdbc/TradeDataSource | select * from quoteejb q where q.symbol=?
[12/15/14 18:24:29:677 IST] 0000002e EventLogging		I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.datasource.psExecuteQuery # contextInfo=jdbc/TradeDataSource | select * from quoteejb q where q.symbol=? # duration=4.968ms
[12/15/14 18:24:29:684 IST] 0000002e EventLogging		I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | /displayQuote.jsp # duration=12.569ms
[12/15/14 18:24:29:685 IST] 0000002e EventLogging		I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | /quote.jsp # duration=152.752ms
[12/15/14 18:24:29:686 IST] 0000002e EventLogging		I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | TradeAppServlet # duration=154.616ms
[12/15/14 18:24:29:687 IST] 0000002e EventLogging		I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | TradeScenarioServlet # duration=158.283ms

要求起自 BEGIN websphere.servlet.service "contextInfo=TradeWeb | TradeScenarioServlet" 事件(參照範例程式碼中的第一行),結束於 END websphere.servlet.service "contextInfo=TradeWeb | TradeScenarioServlet"(參照範例程式碼中的最後一行)。結尾也會顯示此要求所耗費的時間總計(在範例程式碼中是 158.283 毫秒)。

您可以查看主要求的 BEGINEND,以查看子項要求。您也可以找到每一項子項要求所耗費的時間。

為求最佳效能,當啟用事件記載時,您可以使用二進位記載。事件日誌項目中的 eventTypecontextInforequestID 屬性會儲存成日誌記錄延伸。您可以使用這些日誌記錄延伸,利用 binaryLog 指令來過濾日誌。

剖析 messages.log 檔中的事件日誌項目

事件日誌會以下列格式擷取事件資訊:
[日誌模式] [要求 ID] # [事件類型] # [環境定義資訊] # [持續時間](選用)
其中

-「日誌模式」指出要在進入事件還是結束事件時記錄日誌。BEGIN
表示進入事件,END 表示結束事件。-「要求 ID」是指派給每一項要求的唯一字串。這可用來過濾屬於特定要求的事件。範例:requestId=AAY6TalVDTO_AAAAAAAAAAK
-「事件類型」提供事件來源的相關資訊,可以是下表所提供的任何支援的事件類型。事件類型可用來過濾特定類型的事件。範例:eventType=websphere.servlet.service
- 事件的環境定義資訊提供該事件類型的相關詳細資料。資訊會因事件類型而有不同。環境定義資訊可以包含多個區段,並以 | 區隔(空格|空格)。下表提供各種事件類型的環境定義資訊。-「持續時間」指出事件所耗費的時間。持續時間只會出現在結束事件項目中。範例:duration=158.283ms

除了日誌模式是以空格區隔以外,其他所有的日誌屬性都是以 # 區隔(空格#空格)。例如,
[12/15/14 18:24:29:687 IST] 0000002e EventLogging		I END requestID=AAY6TalVDTO_AAAAAAAAAAK # eventType=websphere.servlet.service # contextInfo=TradeWeb | TradeScenarioServlet # duration=158.283ms
下表列出事件記載支援的事件類型:

表 1. 支援的事件類型以及相關的環境定義資訊
元件 事件類型 環境定義資訊 範例

Servlet

websphere.servlet.destroy
websphere.servlet.service

[應用程式名稱] | [Servlet 名稱] | [路徑資訊] | [查詢字串]

contextInfo=TradeWeb | /displayQuote.jsp

階段作業

websphere.session.dbSessionDestroyedByTimeout,
websphere.session.dbSessionDestroyed
websphere.session.sessionAccessed
websphere.session.sessionCreated
websphere.session.sessionDestroyedByTimeout
websphere.session.sessionDestroyed
websphere.session.sessionLiveCountDec
websphere.session.sessionLiveCountInc
websphere.session.sessionReleased

websphere.session.getAttribute
websphere.session.setAttribute

[階段作業 ID]





[階段作業 ID] | [階段作業屬性名稱]

contextInfo=EuitabHZUOD7J2u01HDdAG0





contextInfo=EuitabHZUOD7J2u01HDdAG0 | userID

JDBC

websphere.datasource.execute
websphere.datasource.executeQuery
websphere.datasource.executeUpdate
websphere.datasource.psExecute
websphere.datasource.psExecuteQuery
websphere.datasource.psExecuteUpdate
websphere.datasource.rsCancelRowUpdates
websphere.datasource.rsDeleteRow
websphere.datasource.rsInsertRow
websphere.datasource.rsUpdateRow

[資料來源的 JNDI 名稱名稱] | [SQL 查詢]

contextInfo=jdbc/TradeDataSource | select * from quoteejb q where q.symbol=?


指示主題類型的圖示 參照主題



「時間戳記」圖示 前次更新: 2016 年 11 月 30 日
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=rwlp_eventlogging
檔名:rwlp_eventlogging.html