How do I programmatically enable InternalLogLevel.TRACE for Netty's Http2FrameLogger, relied upon by grpc-java?

16 Views Asked by At

I've enabled grpc-java logging programmatically by doing something along the lines of

java.util.logging.Logger logger = java.util.logging.Logger.getLogger("io.grpc");
java.util.logging.ConsoleHandler consoleHandler = new java.util.logging.ConsoleHandler();
consoleHandler.setLevel(java.util.logging.Level.FINEST);
consoleHandler.setFormatter(new java.util.logging.SimpleFormatter());
logger.addHandler(consoleHandler);
logger.setLevel(java.util.logging.Level.FINEST);

This works, however the logs contain truncated bytes when logging data. The logging of these is done by io.netty.handler.codec.http2.Http2FrameLogger in my case, which contains the following snippet:

    private String toString(ByteBuf buf) {
        if (level == InternalLogLevel.TRACE || buf.readableBytes() <= BUFFER_LENGTH_THRESHOLD) {
            // Log the entire buffer.
            return ByteBufUtil.hexDump(buf);
        }

        // Otherwise just log the first 64 bytes.
        int length = Math.min(buf.readableBytes(), BUFFER_LENGTH_THRESHOLD);
        return ByteBufUtil.hexDump(buf, buf.readerIndex(), length) + "...";
    }

Obviously I need to set that level member to InternalLogLevel.TRACE. How do I achieve that programmatically?

I've tried passing the following JVM parameter to no avail: -Dlogging.level.reactor.netty=trace

0

There are 0 best solutions below