HTTP 存取記載

您可以配置 HTTP 端點的存取日誌設定。

HTTP 存取日誌設定

HTTP 存取日誌包含 HTTP 端點所處理的所有入埠用戶端要求的記錄。 您可以在 HTTP 伺服器中啟用存取記載,或在 Liberty 伺服器中以下列兩種模式之一啟用存取記載:多個端點共用一個日誌,或每個端點各有一個日誌。
註: 如果您沒有指定屬性,就會使用預設值。如果要查看預設屬性清單,請參閱 Java Servlets 3.0 中之 Liberty 配置元素清單中的 HTTPAccessLogging
  • 使用共用日誌

    如果要使用共用設定來啟用多個端點的記載功能,請併入 httpAccessLogging 作為 server.xml 檔的最上層元素,然後從多個 httpEndpoint 元素來參照它:

    <httpAccessLogging id="accessLogging"/>
    <httpEndpoint id="defaultHttpEndpoint" accessLoggingRef="accessLogging"/>
    <httpEndpoint id="otherHttpEndpoint" accessLoggingRef="accessLogging" httpPort="9081" httpsPort="9444"/>
  • 每個端點使用特定日誌

    如果要啟用個別端點的記載,請使用 accessLogging 子元素,並指定不會與其他日誌衝突的檔案路徑:

    <httpEndpoint id="defaultHttpEndpoint">
        <accessLogging filepath="${server.output.dir}/logs/http_defaultEndpoint_access.log"/>
    </httpEndpoint>
  • 使用 HTTP 伺服器的日誌

    如需可用的 HTTP 伺服器端內容清單及其說明,請參閱 Apache 模組 mod_log_config

HTTP 存取日誌格式

如需可用的日誌格式內容清單及其說明,請參閱 HTTP 傳輸通道自訂內容中,WebSphere® Application ServeraccessLogFormat 配置。 這個日誌格式字串是利用 server.xml 檔中 httpAcccessLoggingaccessLogging 元素的 logFormat 屬性來指定的:

<httpAccessLogging logFormat='%h %u %{t}W "%r" %s %b'/>

<httpEndpoint id="defaultHttpEndpoint">
   <accessLogging filepath="${server.output.dir}/logs/http_defaultEndpoint_access.log"
                  logFormat='%h %i %u %t "%r" %s %b' />
</httpEndpoint>

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

檔名:rwlp_http_accesslogs.html