From b0b4c0e3750fac2cf08f640e211c15b4a1339fdc Mon Sep 17 00:00:00 2001 From: Gsealy Jiao Date: Wed, 14 Aug 2019 15:55:27 +0800 Subject: [PATCH] clean duplicate logger --- .../cloud/gateway/support/ServerWebExchangeUtils.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/support/ServerWebExchangeUtils.java b/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/support/ServerWebExchangeUtils.java index 4682de80..821fe805 100644 --- a/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/support/ServerWebExchangeUtils.java +++ b/spring-cloud-gateway-core/src/main/java/org/springframework/cloud/gateway/support/ServerWebExchangeUtils.java @@ -154,8 +154,6 @@ public final class ServerWebExchangeUtils { */ public static final String CACHED_REQUEST_BODY_ATTR = "cachedRequestBody"; - private static final Log logger = LogFactory.getLog(ServerWebExchangeUtils.class); - private ServerWebExchangeUtils() { throw new AssertionError("Must not instantiate utility class."); } @@ -175,8 +173,8 @@ public final class ServerWebExchangeUtils { public static boolean setResponseStatus(ServerWebExchange exchange, HttpStatus httpStatus) { boolean response = exchange.getResponse().setStatusCode(httpStatus); - if (!response && logger.isWarnEnabled()) { - logger.warn("Unable to set status code to " + httpStatus + if (!response && log.isWarnEnabled()) { + log.warn("Unable to set status code to " + httpStatus + ". Response already committed."); } return response; @@ -187,8 +185,8 @@ public final class ServerWebExchangeUtils { if (exchange.getResponse().isCommitted()) { return false; } - if (logger.isDebugEnabled()) { - logger.debug("Setting response status to " + statusHolder); + if (log.isDebugEnabled()) { + log.debug("Setting response status to " + statusHolder); } if (statusHolder.getHttpStatus() != null) { return setResponseStatus(exchange, statusHolder.getHttpStatus());