Exception-based payload logging using the eBay JAVA SDK
Summary
With the eBay Java SDK, you can enable exception-based payload logging and only log API SOAP requests and responses based on pre-registered API error codes, SDK exceptions and /or HTTP Status .
Detailed Description
The sample project below illustrates on how to set all three exception filters in JAVA SDK.
apiContext = new ApiContext(); logging = new ApiLogging(); // Retry object callretry = new CallRetry(); callretry.setMaximumRetries(3); callretry.setDelayTime(1000);
// assign the Api error code of interest String [] apiErrorCodes = new String[]{ "10007", "931" }; callretry.setTriggerApiErrorCodes(apiErrorCodes);
// assign the Exception classes of interest to Class array object java.lang.Class[] tcs = new java.lang.Class[]{ java.net.SocketTimeoutException.class, com.ebay.sdk.SdkSoapException.class }; callretry.setTriggerExceptions(tcs);
// assign Http Status Codes
int[] httpErrorCode = { 502};
com.ebay.sdk.ExceptionFilter excfilter = new com.ebay.sdk.ExceptionFilter(); excfilter.setTriggerApiErrorCodes(apiErrorCodes); excfilter.setTriggerExceptions(tcs); excfilter.setTriggerHTTPErrorCodes(httpErrorCode);