RFR: 8273112: -Xloggc and -Xlog should override -verbose

Xiaowei Lu github.com+39413832+weixlu at openjdk.java.net
Thu Sep 2 03:13:26 UTC 2021


On Wed, 1 Sep 2021 09:44:31 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> According to java 16 specifications for java command (https://docs.oracle.com/en/java/javase/16/docs/specs/man/java.html), the command line option -Xloggc should override -verbose:gc if both options are given with the same java command. However, gc information still outputs to console even if gc log file is specified.
>> 
>> $java -Xloggc:gc.log -verbose:gc -version
>> [0.000s][warning][gc] -Xloggc is deprecated. Will use -Xlog:gc:gc.log instead.
>> [0.003s][info ][gc] Using G1
>> $cat gc.log
>> [0.003s][info][gc] Using G1
>> 
>> In addition, since -Xloggc:filename is replaced by -Xlog:gc:filename, can we assume that -Xlog:gc:filename should override -verbose:gc as -Xloggc:filename? Currently, gclog still outputs to both stdout and file if -Xlog and -verbose are given with the same java command.
>> 
>> $java -Xlog:gc:gc.log -verbose:gc -version
>> [0.003s][info][gc] Using G1
>> $cat gc.log
>> [0.003s][info][gc] Using G1
>> 
>> As a result, we propose to put off the log configuration of -verbose option until we are confident that there isn’t -Xloggc or -Xlog options.
>
> I also can't see how to implement the "overrides" semantics without scanning the entire command-line to collate the different forms of the flag and then collapse them into a single appropriate `-Xlog` definition. And that would be a startup hit.

@dholmes-ora In my commit, the behavior of override is much like "ignore" as you say. We put off the process of `-verbose:gc` until the entire command-line has been parsed. Then we decide whether to ignore `-verbose:gc` or not. As far as I'm concerned, we have to scan the entire command-line firstly.

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

PR: https://git.openjdk.java.net/jdk/pull/5295


More information about the hotspot-runtime-dev mailing list