RFR: 8303682: Simplify HttpClient DebugLogger

Jaikiran Pai jpai at openjdk.org
Wed Mar 8 07:52:15 UTC 2023


On Tue, 7 Mar 2023 10:16:24 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

> The HttpClient internal DebugLogger could be simplified if its configuration was held in a record. Some of the methods in Utils that return a debug logger could also be simplified/removed. The system property that configures the debug logging could be extended to choose between System.err, System.out, System.Logger, or any of these configurations.
> Passing -Djdk.internal.httpclient.debug=true still works as before.

src/java.net.http/share/classes/jdk/internal/net/http/common/DebugLogger.java line 161:

> 159:      *
> 160:      * @param logger The internal logger to which messages will be forwarded.
> 161:      *               This should be either {@link #WS}, {@link #HPACK}, or {@link #HTTP};

Given that the constructor of `DebugLogger` is private and we only expose APIs to create `HTTP`, `WS` and `HPACK` loggers, this statement that the loggers be either of these is true. However, the constructor isn't doesn't do any checks for the `logger` instance (other than null check). Do you think we can drop this sentence?

src/java.net.http/share/classes/jdk/internal/net/http/common/DebugLogger.java line 165:

> 163:      * @param dbgTag A lambda that returns a string that identifies the caller
> 164:      *               (e.g: "SocketTube(3)", or "Http2Connection(SocketTube(3))")
> 165:      * @param config The levels above which messages will be printed to the

This should be `The levels at or above which ....`

-------------

PR: https://git.openjdk.org/jdk/pull/12900


More information about the net-dev mailing list