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