Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to log session ID in weblogic's access log

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

like image 593
Tomas F Avatar asked Nov 11 '09 14:11

Tomas F


1 Answers

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());
    }
}
like image 164
Pascal Thivent Avatar answered Oct 21 '22 05:10

Pascal Thivent