RFR: 8327410: Add hostname option for UL file names [v2]

Johan Sjölen jsjolen at openjdk.org
Fri Mar 8 12:44:53 UTC 2024


On Fri, 8 Mar 2024 12:27:03 GMT, Fredrik Bredberg <fbredberg at openjdk.org> wrote:

>> Added %hn as way to make the Unified Logging file name include the host name.
>> This is done in line with the already existing %p for pid, and %t for time stamp.
>> 
>> Also the %hn decorator is already used to prepend the host name to each log line. See: The [JDK-8148219](https://bugs.openjdk.org/browse/JDK-8148219).
>> 
>> Example: `java -Xlog:gc+init:file=frbr_%hn.%p.%t.log -version`
>> 
>> Tested tier1-tier5.
>
> Fredrik Bredberg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Get the hostname only if the user explicitly requests it

A couple which I'd like to have fixed, but otherwise LGTM. Will send approval after those two are fixed.

src/hotspot/share/logging/logConfiguration.cpp line 617:

> 615:   out->print_cr(" stdout/stderr");
> 616:   out->print_cr(" file=<filename>");
> 617:   out->print_cr("  If the filename contains %%p, %%t and/or %%hn, they will expand to the JVM's PID, startup timestamp and host name, respectively.");

Update copyright for the file, please.

src/hotspot/share/logging/logFileOutput.cpp line 423:

> 421:   assert(PidFilenamePlaceholder[0] == '%' &&
> 422:          TimestampFilenamePlaceholder[0] == '%' &&
> 423:          HostnameFilenamePlaceholder[0] == '%', "must be");

This assertion is just confusing to me, we can't change these values, right?

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

Changes requested by jsjolen (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18153#pullrequestreview-1924787966
PR Review Comment: https://git.openjdk.org/jdk/pull/18153#discussion_r1517660448
PR Review Comment: https://git.openjdk.org/jdk/pull/18153#discussion_r1517663829


More information about the hotspot-runtime-dev mailing list