views:

679

answers:

1

Is it possible to log the session ID in the access log of WebLogic 8.1.6?

+3  A: 

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());
    }
}
Pascal Thivent