diff --git hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerImpl.java hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerImpl.java index cc2f159..6c6e4b7 100644 --- hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerImpl.java +++ hbase-client/src/main/java/org/apache/hadoop/hbase/client/RpcRetryingCallerImpl.java @@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.exceptions.PreemptiveFastFailException; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.util.ExceptionUtil; import org.apache.hadoop.ipc.RemoteException; +import org.apache.hadoop.util.StringUtils; import com.google.protobuf.ServiceException; @@ -110,10 +111,20 @@ public class RpcRetryingCallerImpl implements RpcRetryingCaller { t = translateException(t); if (tries > startLogErrorsCnt) { - LOG.info("Call exception, tries=" + tries + ", maxAttempts=" + maxAttempts + ", started=" - + (EnvironmentEdgeManager.currentTime() - tracker.getStartTime()) + " ms ago, " - + "cancelled=" + cancelled.get() + ", msg=" - + t.getMessage() + " " + callable.getExceptionMessageAdditionalDetail()); + if (LOG.isInfoEnabled()) { + StringBuilder builder = new StringBuilder("Call exception, tries=").append(tries) + .append(", retries=").append(retries).append(", started=") + .append((EnvironmentEdgeManager.currentTime() - this.globalStartTime)) + .append(" ms ago, ").append("cancelled=").append(cancelled.get()) + .append(", msg=").append(t.getMessage()) + .append(", details=").append(callable.getExceptionMessageAdditionalDetail()); + if (LOG.isDebugEnabled()) { + builder.append(", exception=").append(StringUtils.stringifyException(t)); + LOG.debug(builder.toString()); + } else { + LOG.info(builder.toString()); + } + } } callable.throwable(t, maxAttempts != 1); diff --git hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java index dc05af1..57d7c49 100644 --- hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java +++ hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java @@ -100,6 +100,7 @@ import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.token.Token; import org.apache.hadoop.security.token.TokenIdentifier; import org.apache.hadoop.security.token.TokenSelector; +import org.apache.hadoop.util.StringUtils; import org.apache.htrace.Span; import org.apache.htrace.Trace; import org.apache.htrace.TraceScope; @@ -420,8 +421,16 @@ public class RpcClientImpl extends AbstractRpcClient { /* The max number of retries is 45, * which amounts to 20s*45 = 15 minutes retries. */ + if (LOG.isDebugEnabled()) { + LOG.debug("Received exception in connection setup.\n" + + StringUtils.stringifyException(toe)); + } handleConnectionFailure(timeoutFailures++, maxRetries, toe); } catch (IOException ie) { + if (LOG.isDebugEnabled()) { + LOG.debug("Received exception in connection setup.\n" + + StringUtils.stringifyException(ie)); + } handleConnectionFailure(ioFailures++, maxRetries, ie); } } @@ -502,9 +511,11 @@ public class RpcClientImpl extends AbstractRpcClient { ExceptionUtil.rethrowIfInterrupt(ie); } - LOG.info("Retrying connect to server: " + remoteId.getAddress() + - " after sleeping " + failureSleep + "ms. Already tried " + curRetries + - " time(s)."); + if (LOG.isInfoEnabled()) { + LOG.info("Retrying connect to server: " + remoteId.getAddress() + + " after sleeping " + failureSleep + "ms. Already tried " + curRetries + + " time(s)."); + } } /** @@ -654,7 +665,7 @@ public class RpcClientImpl extends AbstractRpcClient { if (currRetries < maxRetries) { if (LOG.isDebugEnabled()) { LOG.debug("Exception encountered while connecting to " + - "the server : " + ex); + "the server : " + StringUtils.stringifyException(ex)); } //try re-login if (UserGroupInformation.isLoginKeytabBased()) {