Sun Java System Instant Messaging 7.2 管理指南

管理 XMPP/HTTP 閘道記錄

您可以配置 XMPP/HTTP 閘道的記錄層級,完全啟用或停用記錄,並變更閘道記錄檔案或閘道記錄配置檔案的位置,如以下各節所述:

如需 Instant Messaging 所支援 log4j 格式的詳細資訊,參見 Apache Logging Services 網站

Procedure啟用或停用 XMPP/HTTP 閘道記錄

啟用或停用閘道記錄的方法有兩種:

在大多數情況下,您應該修改 httpbind_log4j.conf 檔案本身中的配置,保留將 httpbind.log4j.config 參數設定為 httpbind_log4j.conf 檔案的位置。此程序描述如何修改 httpbind_log4j.conf 檔案內的配置。

  1. 開啟 httpbind_log4j.conf 檔案。

    此檔案儲存於您在 httpbind.conf 檔案中所指定的位置,作為 httpbind.log4j.config 參數的值。依預設,此檔案儲存於預設 Instant Messaging 實例下的下列目錄:


    im-cfg-base/httpbind_log4j.conf
  2. 若要停用閘道記錄,請將 log4j.logger.gateway 參數設定如下:


    log4j.logger.gateway=OFF
    
  3. 若要啟用記錄,請將 log4j.logger.gateway 參數設定為所需的記錄層級。

    例如:


    log4j.logger.gateway=ERROR
    

    如需您可使用的有效記錄層級清單,請參閱表 13–1

  4. 儲存並關閉 httpbind_log4j.conf

Procedure變更 XMPP/HTTP 閘道記錄配置檔案位置

  1. 開啟 httpbind.conf

    如需尋找此檔案的詳細資訊,請參閱 httpbind.conf 檔案位置

  2. httpbind.log4j.config 參數值設定為 XMPP/HTTP 閘道記錄配置檔案的位置。

  3. 儲存並關閉 httpbind.conf

  4. 使用 Web 或應用程式伺服器提供的工具重新啟動閘道。

ProcedureLinux: 安裝或升級後設定 XMPP/HTTP 閘道記錄檔案位置

在 Linux 上,當您安裝並配置 XMPP/HTTP 閘道後,您需要修改 httpbind_log4j.conf 中 XMPP/HTTP 閘道的預設記錄檔案位置。

  1. 開啟 httpbind_log4j.conf 檔案。

    此檔案儲存於您在 httpbind.conf 檔案中所指定的位置,作為 httpbind.log4j.config 參數的值。依預設,此檔案儲存於預設 Instant Messaging 實例下的下列目錄:


    im-cfg-base/httpbind_log4j.conf
  2. log4.appender.appender_ID.file 參數值設定為記錄檔案的儲存位置。

Procedure變更 XMPP/HTTP 閘道記錄檔案位置

開始之前

請確定您熟悉 Apache Logging Services 網站中所述的 log4j 語法和一般實作。

  1. 開啟 httpbind_log4j.conf

    此檔案儲存於您在 httpbind.conf 檔案中所指定的位置,作為 httpbind.log4j.config 參數的值。依預設,此檔案儲存於預設 Instant Messaging 實例下的下列目錄:


    im-cfg-base/httpbind_log4j.conf
  2. log4j.appender. appender-ID 參數值設定為您要儲存記錄檔案的位置。

  3. 儲存並關閉 httpbind_log4j.conf

  4. 重新啟動 Web 容器。

Procedure使用 XMPP/HTTP 閘道非預設記錄檔案位置

如果選擇使用非預設的記錄位置,您需要修改 httpbind_log4j.conf 中 XMPP/HTTP 閘道的預設記錄檔案位置。

  1. 開啟 httpbind_log4j.conf 檔案。

    此檔案儲存於您在 httpbind.conf 檔案中所指定的位置,作為 httpbind.log4j.config 參數的值。依預設,此檔案儲存於預設 Instant Messaging 實例下的下列目錄:


    im-cfg-base/httpbind_log4j.conf
  2. log4.appender.appender_ID.file 參數值設定為記錄檔案的儲存位置。

Procedure設定 XMPP/HTTP 閘道記錄層級

開始之前

請確定您熟悉 Apache Logging Services 網站中所述的 log4j 語法和一般實作。

  1. 開啟 httpbind_log4j.conf

    此檔案儲存於您在 httpbind.conf 檔案中所指定的位置,作為 httpbind.log4j.config 參數的值。依預設,此檔案儲存於預設 Instant Messaging 實例下的下列目錄:


    im-cfg-base/httpbind_log4j.conf
  2. log4j.logger.gateway 參數設定為所需的記錄層級。

    例如:


    log4j.logger.gateway=ERROR
    

    如需您可使用的有效記錄層級清單,請參閱表 13–1

XMPP/HTTP 閘道 log4j 記錄配置檔案語法

如需 log4j 語法和一般實作的詳細資訊,請參閱 Apache Logging Services 網站。閘道記錄配置檔案語法如下:


log4j.logger.gateway=logging-level, Appender-ID
# DEFAULT TO RollingFileAppender
log4j.appender.Appender-ID=org.apache.log4j.RollingFileAppender
log4j.appender.Appender-ID.file=log-dir/httpbind.log
log4j.appender.Appender-ID.append=true|false
log4j.appender.Appender-ID.maxBackupIndex=7
log4j.appender.Appender-ID.maxFileSize=max-log-file-size
log4j.appender.Appender-ID.layout=org.apache.log4j.PatternLayout
log4j.appender.Appender-ID.layout.ConversionPattern=log-entry-syntax

範例 10–1 XMPP/HTTP 閘道記錄配置檔案 (httpbind_log4j.conf )


log4j.logger.gateway=ERROR, A1
# DEFAULT TO RollingFileAppender
log4j.appender.A1=org.apache.log4j.RollingFileAppender
# log4j.appender.A1.file=$(logdir)/gateway.log
log4j.appender.A1.file=/tmp/gatewaylog
log4j.appender.A1.append=true
log4j.appender.A1.maxBackupIndex=7
log4j.appender.A1.maxFileSize=5mb
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=[%d{DATE}] %-5p %c [%t] %m%n