diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker07.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker07.java index ffc11f7b04..1299a00287 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker07.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker07.java @@ -110,8 +110,9 @@ public class WebSocketClientHandshaker07 extends WebSocketClientHandshaker { expectedChallengeResponseString = WebSocketUtil.base64(sha1); if (logger.isDebugEnabled()) { - logger.debug(String.format("WS Version 07 Client Handshake key: %s. Expected response: %s.", key, - expectedChallengeResponseString)); + logger.debug( + "WebSocket version 07 client handshake key: {}, expected response: {}", + key, expectedChallengeResponseString); } // Format request diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker08.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker08.java index 3045201106..58914c423c 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker08.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker08.java @@ -112,8 +112,9 @@ public class WebSocketClientHandshaker08 extends WebSocketClientHandshaker { expectedChallengeResponseString = WebSocketUtil.base64(sha1); if (logger.isDebugEnabled()) { - logger.debug(String.format("WS Version 08 Client Handshake key: %s. Expected response: %s.", key, - expectedChallengeResponseString)); + logger.debug( + "WebSocket version 08 client handshake key: {}, expected response: {}", + key, expectedChallengeResponseString); } // Format request diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker13.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker13.java index a6f5e87682..b4c8a77ea4 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker13.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker13.java @@ -111,8 +111,9 @@ public class WebSocketClientHandshaker13 extends WebSocketClientHandshaker { expectedChallengeResponseString = WebSocketUtil.base64(sha1); if (logger.isDebugEnabled()) { - logger.debug(String.format("WS Version 13 Client Handshake key: %s. Expected response: %s.", key, - expectedChallengeResponseString)); + logger.debug( + "WebSocket version 13 client handshake key: {}, expected response: {}", + key, expectedChallengeResponseString); } // Format request diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java index 22c8198d8e..f94b4f79f3 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java @@ -156,7 +156,7 @@ public abstract class WebSocketServerHandshaker { HttpHeaders responseHeaders, final ChannelPromise promise) { if (logger.isDebugEnabled()) { - logger.debug(String.format("%s WS Version %s server handshake", channel, version())); + logger.debug("%s WebSocket version %s server handshake", channel, version()); } FullHttpResponse response = newHandshakeResponse(req, responseHeaders); ChannelPipeline p = channel.pipeline(); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java index 38cde0d839..a32aa67277 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00.java @@ -137,7 +137,7 @@ public class WebSocketServerHandshaker00 extends WebSocketServerHandshaker { String selectedSubprotocol = selectSubprotocol(subprotocols); if (selectedSubprotocol == null) { if (logger.isDebugEnabled()) { - logger.debug(String.format("Requested subprotocol(s) not supported: %s.", subprotocols)); + logger.debug("Requested subprotocol(s) not supported: {}", subprotocols); } } else { res.headers().add(SEC_WEBSOCKET_PROTOCOL, selectedSubprotocol); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker07.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker07.java index 27e97ebbdf..c2ede4a11f 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker07.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker07.java @@ -113,7 +113,7 @@ public class WebSocketServerHandshaker07 extends WebSocketServerHandshaker { String accept = WebSocketUtil.base64(sha1); if (logger.isDebugEnabled()) { - logger.debug(String.format("WS Version 7 Server Handshake key: %s. Response: %s.", key, accept)); + logger.debug("WebSocket version 07 server handshake key: {}, response: %s.", key, accept); } res.headers().add(Names.UPGRADE, WEBSOCKET); @@ -124,7 +124,7 @@ public class WebSocketServerHandshaker07 extends WebSocketServerHandshaker { String selectedSubprotocol = selectSubprotocol(subprotocols); if (selectedSubprotocol == null) { if (logger.isDebugEnabled()) { - logger.debug(String.format("Requested subprotocol(s) not supported: %s.", subprotocols)); + logger.debug("Requested subprotocol(s) not supported: {}", subprotocols); } } else { res.headers().add(Names.SEC_WEBSOCKET_PROTOCOL, selectedSubprotocol); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker08.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker08.java index aa6f369677..797e6d06fb 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker08.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker08.java @@ -112,7 +112,7 @@ public class WebSocketServerHandshaker08 extends WebSocketServerHandshaker { String accept = WebSocketUtil.base64(sha1); if (logger.isDebugEnabled()) { - logger.debug(String.format("WS Version 8 Server Handshake key: %s. Response: %s.", key, accept)); + logger.debug("WebSocket version 08 server handshake key: {}, response: {}", key, accept); } res.headers().add(Names.UPGRADE, WEBSOCKET); @@ -123,7 +123,7 @@ public class WebSocketServerHandshaker08 extends WebSocketServerHandshaker { String selectedSubprotocol = selectSubprotocol(subprotocols); if (selectedSubprotocol == null) { if (logger.isDebugEnabled()) { - logger.debug(String.format("Requested subprotocol(s) not supported: %s.", subprotocols)); + logger.debug("Requested subprotocol(s) not supported: {}", subprotocols); } } else { res.headers().add(Names.SEC_WEBSOCKET_PROTOCOL, selectedSubprotocol); diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13.java b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13.java index 0ed048e52b..6f4cd8348b 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13.java @@ -109,7 +109,7 @@ public class WebSocketServerHandshaker13 extends WebSocketServerHandshaker { String accept = WebSocketUtil.base64(sha1); if (logger.isDebugEnabled()) { - logger.debug(String.format("WS Version 13 Server Handshake key: %s. Response: %s.", key, accept)); + logger.debug("WebSocket version 13 server handshake key: {}, response: {}", key, accept); } res.headers().add(Names.UPGRADE, WEBSOCKET); @@ -120,7 +120,7 @@ public class WebSocketServerHandshaker13 extends WebSocketServerHandshaker { String selectedSubprotocol = selectSubprotocol(subprotocols); if (selectedSubprotocol == null) { if (logger.isDebugEnabled()) { - logger.debug(String.format("Requested subprotocol(s) not supported: %s.", subprotocols)); + logger.debug("Requested subprotocol(s) not supported: {}", subprotocols); } } else { res.headers().add(Names.SEC_WEBSOCKET_PROTOCOL, selectedSubprotocol); diff --git a/handler/src/main/java/io/netty/handler/logging/LoggingHandler.java b/handler/src/main/java/io/netty/handler/logging/LoggingHandler.java index 3ab74f251e..eabd70733c 100644 --- a/handler/src/main/java/io/netty/handler/logging/LoggingHandler.java +++ b/handler/src/main/java/io/netty/handler/logging/LoggingHandler.java @@ -21,6 +21,7 @@ import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandlerAdapter; import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelOutboundHandler; import io.netty.channel.ChannelPromise; import io.netty.util.internal.StringUtil; import io.netty.util.internal.logging.InternalLogLevel; @@ -39,7 +40,7 @@ public class LoggingHandler extends ChannelHandlerAdapter { private static final LogLevel DEFAULT_LEVEL = LogLevel.DEBUG; - private static final String NEWLINE = String.format("%n"); + private static final String NEWLINE = StringUtil.NEWLINE; private static final String[] BYTE2HEX = new String[256]; private static final String[] HEXPADDING = new String[16]; @@ -316,7 +317,7 @@ public class LoggingHandler extends ChannelHandlerAdapter { /** * Formats an event and returns the formatted message. This method is currently only used for formatting - * {@link ChannelHandler#connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)}. + * {@link ChannelOutboundHandler#connect(ChannelHandlerContext, SocketAddress, SocketAddress, ChannelPromise)}. * * @param eventName the name of the event * @param firstArg the first argument of the event