Last active
April 1, 2021 20:27
WebLogic HTTP Header to log OPRID for PeopleSoft pages to the access log (from @ripleymj).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import weblogic.servlet.logging.CustomELFLogger; | |
import weblogic.servlet.logging.FormatStringBuffer; | |
import weblogic.servlet.logging.HttpAccountingInfo; | |
import java.lang.reflect.Method; | |
public class OPRIDLogField implements CustomELFLogger | |
{ | |
public void logField(HttpAccountingInfo metrics, FormatStringBuffer buff) | |
{ | |
Object psperfenv = metrics.getAttribute("psperfenv"); | |
if(psperfenv != null) | |
{ | |
try | |
{ | |
Method getOperID = psperfenv.getClass().getMethod("getOPERID"); | |
buff.appendValueOrDash(getOperID.invoke(psperfenv).toString()); | |
} | |
catch(Exception e) | |
{ | |
buff.appendValueOrDash("exception"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The log field is named
x-OPRIDLogField
.To compile:
javac -cp weblogic.jar OPRIDLogField.java && jar cf olf.jar OPRIDLogField.class
Copy the
OPRIDLogField.jar
to a folder on the web server and add the path theCLASSPATH
option insetEnv
.