|
21 | 21 | import io.netty.channel.ChannelDuplexHandler;
|
22 | 22 | import io.netty.channel.ChannelHandlerContext;
|
23 | 23 | import io.netty.channel.ChannelOption;
|
| 24 | +import io.netty.channel.ChannelPipeline; |
24 | 25 | import io.netty.channel.EventLoopGroup;
|
25 | 26 | import io.netty.channel.ServerChannel;
|
26 | 27 | import io.netty.channel.epoll.Epoll;
|
27 | 28 | import io.netty.channel.socket.DatagramChannel;
|
28 | 29 | import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
|
| 30 | +import io.netty.handler.logging.LogLevel; |
| 31 | +import io.netty.handler.logging.LoggingHandler; |
29 | 32 | import io.netty.util.ReferenceCountUtil;
|
| 33 | +import io.netty.util.internal.logging.InternalLogger; |
| 34 | +import io.netty.util.internal.logging.InternalLoggerFactory; |
30 | 35 | import io.r2dbc.postgresql.message.backend.BackendKeyData;
|
31 | 36 | import io.r2dbc.postgresql.message.backend.BackendMessage;
|
32 | 37 | import io.r2dbc.postgresql.message.backend.BackendMessageDecoder;
|
@@ -303,7 +308,18 @@ public static Mono<ReactorNettyClient> connect(ConnectionProvider connectionProv
|
303 | 308 | tcpClient = tcpClient.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, Math.toIntExact(connectTimeout.toMillis()));
|
304 | 309 | }
|
305 | 310 |
|
306 |
| - return tcpClient.connect().flatMap(it -> registerSslHandler(sslConfig, it).thenReturn(new ReactorNettyClient(it))); |
| 311 | + return tcpClient.connect().flatMap(it -> { |
| 312 | + |
| 313 | + ChannelPipeline pipeline = it.channel().pipeline(); |
| 314 | + |
| 315 | + InternalLogger logger = InternalLoggerFactory.getInstance(ReactorNettyClient.class); |
| 316 | + if (logger.isTraceEnabled()) { |
| 317 | + pipeline.addFirst(LoggingHandler.class.getSimpleName(), |
| 318 | + new LoggingHandler(ReactorNettyClient.class, LogLevel.TRACE)); |
| 319 | + } |
| 320 | + |
| 321 | + return registerSslHandler(sslConfig, it).thenReturn(new ReactorNettyClient(it)); |
| 322 | + }); |
307 | 323 | }
|
308 | 324 |
|
309 | 325 | private static Mono<? extends Void> registerSslHandler(SSLConfig sslConfig, Connection it) {
|
|
0 commit comments