Integrated: 8320577: Improve MessageHeader's toString() function to make HttpURLConnection's debug log readable
Oliver Lockwood
duke at openjdk.org
Wed Nov 22 18:28:21 UTC 2023
On Fri, 10 Nov 2023 14:23:19 GMT, Oliver Lockwood <duke at openjdk.org> wrote:
> At the moment, if you have debug logging turned on for the `HttpURLConnection` class, then from [line 746](https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java#L746) a log message like this is generated:
>> sun.net.www.MessageHeader at 49c4f2906 pairs: {null: HTTP/1.1 200}{Content-Type: application/json}{Transfer-Encoding: chunked}{Date: Thu, 09 Nov 2023 11:50:00 GMT}{Keep-Alive: timeout=60}{Connection: keep-alive}
>
> The lack of separation after the `Object.toString()` output makes it hard to realise from the above that it's trying to say "6 pairs".
> The change proposed by this PR would make the same log operation output this, instead:
>> sun.net.www.MessageHeader at 49c4f290 6 pairs: {null: HTTP/1.1 200}{Content-Type: application/json}{Transfer-Encoding: chunked}{Date: Thu, 09 Nov 2023 11:50:00 GMT}{Keep-Alive: timeout=60}{Connection: keep-alive}
This pull request has now been integrated.
Changeset: aac43184
Author: Oliver Lockwood <olockwood at dalet.com>
Committer: Daniel Fuchs <dfuchs at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/aac43184319d852eb792c83dfb52d74a3126108d
Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
8320577: Improve MessageHeader's toString() function to make HttpURLConnection's debug log readable
Reviewed-by: dfuchs, jpai
-------------
PR: https://git.openjdk.org/jdk/pull/16615
More information about the net-dev
mailing list