是否可以在 WebLogic 8.1.6 的访问日志中记录会话 ID?
问问题
4744 次
1 回答
8
是的,这可以使用Extended Log Format和Custom 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 回答