Using Netty 4.0.0.Beta1, what would be the best way for me to log the incoming/outgoing HTTP traffic to a netty-based server? My pipeline is currently:
p.addLast("decoder", new HttpRequestDecoder());
p.addLast("aggregator", new HttpObjectAggregator(1048576));
p.addLast("encoder", new HttpResponseEncoder());
p.addLast("handler", new MyBusinessLogicHandler());
I tried writing a handler that implements ChannelInboundMessageHandler<FullHttpRequest>, and then does the logging in the inboundBufferUpdated(ChannelHandlerContext ctx) method, which seems to work fine for incoming requests, but is that the recommended way?
When I tried to implement ChannelOutboundMessageHandler<FullHttpResponse>, I wasn't successful in seeing the actual FullHttpResponse objects inside the flush(ChannelHandlerContext ctx, ChannelPromise promise) method.
Suggestions? Thanks!