This topic describes how to use the MaxCompute Java SDK to return error logs.

The MaxCompute Java SDK provides the abstract class RetryLogger. For more information, see the MaxCompute Java SDK documentation.
public static abstract class RetryLogger {
 * The callback function that enables RestClient to retry if an error occurs.
 * @param e
 *     The error.
 * @param retryCount
 *     The number of retries.
 * @param retrySleepTime
 *     The retry time required next time.
public abstract void onRetryLog(Throwable e, long retryCount, long retrySleepTime);

You only need to create a RetryLogger subclass, and then use odps.getRestClient().setRetryLogger(new UserRetryLogger()); to return logs when initializing MaxCompute objects.

Typical example
// init odps
odps.getRestClient().setRetryLogger(new UserRetryLogger());
// your retry logger
public class UserRetryLogger extends RetryLogger {
 public void onRetryLog(Throwable e, long retryCount, long sleepTime) {
   if (e ! = null && e instanceof OdpsException) {
     String requestId = ((OdpsException) e).getRequestId();
             if (requestId ! = null) {
           "Warning: ODPS request failed, requestID:%s, retryCount:%d, will retry in %d seconds.", requestId, retryCount, sleepTime));
       "Warning: ODPS request failed:%s, retryCount:%d, will retry in %d seconds.", e.getMessage(), retryCount, sleepTime));