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

This commit is contained in:
Michael Stack 2018-06-23 19:22:33 -07:00
parent 3673bfc241
commit 3f319bef8d
1 changed files with 20 additions and 27 deletions

View File

@ -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());
}
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()");
}
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);
}
/**