On Thu, 25 Jun 2026 07:37:24 GMT, Volkan Yazici <[email protected]> wrote:
>> src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java line 542: >> >>> 540: // ahead and close this connection >>> without processing it >>> 541: logger.log(Level.DEBUG, >>> "connection limit reached, " + >>> 542: "closing accepted >>> connection"); >> >> Does the logging by code in the httpserver include something to identity the >> instance? I'm wondering how the log messages look when there is more than >> one instance in the VM. > >> Does the logging by code in the httpserver include something to identity the >> instance? > > Nope, it doesn't. For tests, it doesn't matter much — since most HTTP server > & client tests run sequentially. While skimming through logs, you can > reliably guess which log belongs to which server. That said, for production > applications containing multiple HTTP servers, an identifier in the log would > be super helpful while troubleshooting. It'd even help with the cognitive > load in test logs. @kieran-farrell, @dfuch, do you agree? > >> I'm wondering how the log messages look when there is more than one instance >> in the VM. > > They get interleaved. Consider the following JTreg log snippet from a > `test/jdk/com/sun/net/httpserver/ClearTextServerSSL` execution: > > > [18:28:00.715] STARTED ClearTextServerSSL::test 'test()' > Jun 24, 2026 6:28:00 PM sun.net.httpserver.ServerImpl <init> > FINE: HttpServer created http localhost/127.0.0.1:0 > Jun 24, 2026 6:28:00 PM sun.net.httpserver.ServerImpl createContext > FINE: context created: /ClearTextServerSSL/ > Jun 24, 2026 6:28:01 PM sun.net.httpserver.ServerImpl$Exchange run > FINER: exchange started > Jun 24, 2026 6:28:01 PM sun.net.httpserver.ServerImpl$Exchange run > FINE: Exchange request line: GET /ClearTextServerSSL/clear HTTP/1.1 > Jun 24, 2026 6:28:01 PM sun.net.httpserver.ExchangeImpl sendResponseHeaders > FINER: Sent headers: noContentToSend=true It might be better to include the channel being closed in the log message. Something like: logger.log(Level.DEBUG, "connection limit reached, closing accepted connection " + chan); That should provide one form of identification because it will include the local and remote host/port details of the connection being closed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31670#discussion_r3472906863
