How to log session ID in weblogic's access log
Is it possible to log the session ID in the access l开发者_JAVA百科og of WebLogic 8.1.6?
Yes, this is possible using Extended Log Format and Custom Field Identifiers. I'm providing a Java implementation of a custom field printing the session ID below. Follow the steps of the 2nd link to setup the whole solution. Adapt the fully-qualified name as per your preferences.
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());
}
}
精彩评论