Skip to content

Commit

Permalink
[SSHD-1230] Log netty channel traffic on TRACE level
Browse files Browse the repository at this point in the history
  • Loading branch information
rovarga committed Nov 25, 2021
1 parent c80b88f commit f8069c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
* @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a>
*/
public class NettyIoAcceptor extends NettyIoService implements IoAcceptor {
// Shared across all acceptors
private static final LoggingHandler LOGGING_TRACE = new LoggingHandler(NettyIoAcceptor.class, LogLevel.TRACE);

protected final ServerBootstrap bootstrap = new ServerBootstrap();
protected final Map<SocketAddress, Channel> boundAddresses = new ConcurrentHashMap<>();

Expand All @@ -66,7 +69,7 @@ public NettyIoAcceptor(NettyIoServiceFactory factory, IoHandler handler) {
bootstrap.group(factory.eventLoopGroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.SO_BACKLOG, 100) // TODO make this configurable
.handler(new LoggingHandler(LogLevel.INFO)) // TODO make this configurable
.handler(LOGGING_TRACE) // TODO make this configurable
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
@SuppressWarnings("synthetic-access")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
* @author <a href="mailto:[email protected]">Apache MINA SSHD Project</a>
*/
public class NettyIoConnector extends NettyIoService implements IoConnector {
// Shared across all connectors
private static final LoggingHandler LOGGING_TRACE = new LoggingHandler(NettyIoConnector.class, LogLevel.TRACE);

protected final Bootstrap bootstrap = new Bootstrap();

public NettyIoConnector(NettyIoServiceFactory factory, IoHandler handler) {
Expand Down Expand Up @@ -83,7 +86,7 @@ protected void initChannel(SocketChannel ch) throws Exception {
}

ChannelPipeline p = ch.pipeline();
p.addLast(new LoggingHandler(LogLevel.INFO)); // TODO make this configurable
p.addLast(LOGGING_TRACE); // TODO make this configurable
p.addLast(session.adapter);
} catch (Exception e) {
if (listener != null) {
Expand Down

0 comments on commit f8069c6

Please sign in to comment.