HBASE-20780 ServerRpcConnection logging cleanup Get rid of one of the logging 
lines in ServerRpcConnection by amalgamating all into one new-style log line.


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4ba6242a
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4ba6242a
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4ba6242a

Branch: refs/heads/HBASE-19064
Commit: 4ba6242a62e6aa0ce96dd9dda9b471cbb357134a
Parents: 0db2b62
Author: Michael Stack <st...@apache.org>
Authored: Sat Jun 23 19:22:33 2018 -0700
Committer: Michael Stack <st...@apache.org>
Committed: Mon Jun 25 16:43:11 2018 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/ipc/ServerRpcConnection.java   | 47 +++++++++-----------
 1 file changed, 20 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/4ba6242a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java
index 17bb362..cff917f 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java
@@ -342,10 +342,8 @@ abstract class ServerRpcConnection implements Closeable {
   public void saslReadAndProcess(ByteBuff saslToken) throws IOException,
       InterruptedException {
     if (saslContextEstablished) {
-      if (RpcServer.LOG.isTraceEnabled())
-        RpcServer.LOG.trace("Have read input token of size " + 
saslToken.limit()
-            + " for processing by saslServer.unwrap()");
-
+      RpcServer.LOG.trace("Read input token of size={} for processing by 
saslServer.unwrap()",
+        saslToken.limit());
       if (!useWrap) {
         processOneRpc(saslToken);
       } else {
@@ -365,17 +363,13 @@ abstract class ServerRpcConnection implements Closeable {
         if (saslServer == null) {
           saslServer =
               new HBaseSaslRpcServer(authMethod, rpcServer.saslProps, 
rpcServer.secretManager);
-          if (RpcServer.LOG.isDebugEnabled()) {
-            RpcServer.LOG
-                .debug("Created SASL server with mechanism = " + 
authMethod.getMechanismName());
-          }
-        }
-        if (RpcServer.LOG.isDebugEnabled()) {
-          RpcServer.LOG.debug("Have read input token of size " + 
saslToken.limit()
-              + " for processing by saslServer.evaluateResponse()");
+          RpcServer.LOG.debug("Created SASL server with mechanism={}",
+              authMethod.getMechanismName());
         }
-        replyToken = saslServer
-            .evaluateResponse(saslToken.hasArray() ? saslToken.array() : 
saslToken.toBytes());
+        RpcServer.LOG.debug("Read input token of size={} for processing by 
saslServer." +
+            "evaluateResponse()", saslToken.limit());
+        replyToken = saslServer.evaluateResponse(saslToken.hasArray()?
+            saslToken.array() : saslToken.toBytes());
       } catch (IOException e) {
         IOException sendToClient = e;
         Throwable cause = e;
@@ -500,8 +494,8 @@ abstract class ServerRpcConnection implements Closeable {
     if (buf.hasArray()) {
       this.connectionHeader = ConnectionHeader.parseFrom(buf.array());
     } else {
-      CodedInputStream cis = UnsafeByteOperations
-          .unsafeWrap(new ByteBuffByteInput(buf, 0, buf.limit()), 0, 
buf.limit()).newCodedInput();
+      CodedInputStream cis = UnsafeByteOperations.unsafeWrap(
+          new ByteBuffByteInput(buf, 0, buf.limit()), 0, 
buf.limit()).newCodedInput();
       cis.enableAliasing(true);
       this.connectionHeader = ConnectionHeader.parseFrom(cis);
     }
@@ -522,10 +516,9 @@ abstract class ServerRpcConnection implements Closeable {
       }
       // audit logging for SASL authenticated users happens in 
saslReadAndProcess()
       if (authenticatedWithFallback) {
-        RpcServer.LOG.warn("Allowed fallback to SIMPLE auth for " + ugi
-            + " connecting from " + getHostAddress());
+        RpcServer.LOG.warn("Allowed fallback to SIMPLE auth for {} connecting 
from {}",
+            ugi, getHostAddress());
       }
-      RpcServer.AUDITLOG.info(RpcServer.AUTH_SUCCESSFUL_FOR + ugi);
     } else {
       // user is authenticated
       ugi.setAuthenticationMethod(authMethod.authenticationMethod);
@@ -551,17 +544,17 @@ abstract class ServerRpcConnection implements Closeable {
         }
       }
     }
-    if (connectionHeader.hasVersionInfo()) {
+    String version;
+    if (this.connectionHeader.hasVersionInfo()) {
       // see if this connection will support RetryImmediatelyException
-      retryImmediatelySupported = 
VersionInfoUtil.hasMinimumVersion(getVersionInfo(), 1, 2);
-
-      RpcServer.AUDITLOG.info("Connection from " + this.hostAddress + " port: 
" + this.remotePort
-          + " with version info: "
-          + TextFormat.shortDebugString(connectionHeader.getVersionInfo()));
+      this.retryImmediatelySupported =
+          VersionInfoUtil.hasMinimumVersion(getVersionInfo(), 1, 2);
+      version = this.connectionHeader.getVersionInfo().getVersion();
     } else {
-      RpcServer.AUDITLOG.info("Connection from " + this.hostAddress + " port: 
" + this.remotePort
-          + " with unknown version info");
+      version = "UNKNOWN";
     }
+    RpcServer.AUDITLOG.info("Connection from {}:{}, version={}, sasl={}, 
ugi={}, service={}",
+        this.hostAddress, this.remotePort, version, this.useSasl, this.ugi, 
serviceName);
   }
 
   /**

Reply via email to