Skip to content

Instantly share code, notes, and snippets.

@iversond iversond/x-OPPRIDLogField
Last active Mar 8, 2017

Embed
What would you like to do?
WebLogic HTTP Header to log OPRID for PeopleSoft pages to the access log (from @ripleymj).
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");
}
}
}
}
@iversond

This comment has been minimized.

Copy link
Owner Author

commented Nov 23, 2016

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 the CLASSPATH option in setEnv.

@ripleymj

This comment has been minimized.

Copy link

commented Dec 2, 2016

I should probably take the blame for this, instead of @ripley. When I was working on this, putting the jar in psft/pt/8.55/webserv/peoplesoft/lib/ keeps you from having to modify setEnv. @iversond also pointed out that this relies on having the PPM agent enabled on the web server.

@iversond

This comment has been minimized.

Copy link
Owner Author

commented Dec 14, 2016

@ripleymj - fixed the attribution in the description :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.