diff --git a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java index 3b5f21e84..1697ad6ae 100644 --- a/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java +++ b/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java @@ -320,11 +320,9 @@ public class TThreadPoolServer extends TServer { // Ignore err-logging all transport-level/type exceptions if ((realCause != null && realCause instanceof TTransportException) || (x instanceof TTransportException)) { - if (LOGGER.isDebugEnabled()) { - // Write to debug, just in case the exception gets required - LOGGER - .debug("Received TTransportException during processing of message, ignoring: ", x); - } + LOGGER.debug( + "Received TTransportException during processing of message. Ignoring.", + x); } else { // Log the exception at error level and continue LOGGER.error("Error occurred during processing of message.", x); diff --git a/lib/java/src/org/apache/thrift/transport/TSaslTransport.java b/lib/java/src/org/apache/thrift/transport/TSaslTransport.java index 80f355710..bed3b395e 100644 --- a/lib/java/src/org/apache/thrift/transport/TSaslTransport.java +++ b/lib/java/src/org/apache/thrift/transport/TSaslTransport.java @@ -158,9 +158,9 @@ abstract class TSaslTransport extends TTransport { messageHeader[0] = status.getValue(); EncodingUtils.encodeBigEndian(payload.length, messageHeader, STATUS_BYTES); - if (LOGGER.isDebugEnabled()) - LOGGER.debug(getRole() + ": Writing message with status {} and payload length {}", - status, payload.length); + LOGGER.debug("{}: Writing message with status {} and payload length {}", + getRole(), status, payload.length); + underlyingTransport.write(messageHeader); underlyingTransport.write(payload); underlyingTransport.flush(); @@ -197,10 +197,8 @@ abstract class TSaslTransport extends TTransport { String remoteMessage = new String(payload, StandardCharsets.UTF_8); throw new TTransportException("Peer indicated failure: " + remoteMessage); } - - if (LOGGER.isDebugEnabled()) - LOGGER.debug(getRole() + ": Received message with status {} and payload length {}", - status, payload.length); + LOGGER.debug("{}: Received message with status {} and payload length {}", + getRole(), status, payload.length); return new SaslResponse(status, payload); }