6

是否可以在 WebLogic 8.1.6 的访问日志中记录会话 ID?

4

1 回答 1

8

是的,这可以使用Extended Log FormatCustom Field Identifiers来实现。我正在提供一个自定义字段的 Java 实现,该字段打印下面的会话 ID。按照第二个链接的步骤设置整个解决方案。根据您的喜好调整完全限定名称。

import weblogic.servlet.logging.CustomELFLogger;
import weblogic.servlet.logging.FormatStringBuffer;
import weblogic.servlet.logging.HttpAccountingInfo;

/** 
 * Outputs the session ID specified by the client into a custom field called MyCustomField
 */
public class MyCustomField implements CustomELFLogger {

    public void logField(HttpAccountingInfo metrics, FormatStringBuffer buff) {
        buff.appendValueOrDash(metrics.getRequestedSessionId());
    }
}
于 2009-11-11T19:02:23.270 回答