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

Xiaowei Lu github.com+39413832+weixlu at openjdk.java.net
Wed Sep 1 07:36:48 UTC 2021


On Wed, 1 Sep 2021 02:03:48 GMT, Ioi Lam <iklam 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.
>
> src/hotspot/share/runtime/arguments.cpp line 2965:
> 
>> 2963:     }
>> 2964:     if (ts->contains(LogTag::_class) && ts->has_output_to_file()) {
>> 2965:       has_verbose_class = false;
> 
> This doesn't seem correct to me. If the command line is:
> 
> 
> java -Xlog:class+resolve=debug:file=log.txt -verbose:class -version
> 
> 
> We should have the following:
> 
> 
> (a) class,load -> stdout
> (b) class,unload -> stdout
> (c) class,resolve -> log.txt
> 
> 
> But your change will disable both (a) and (b).
> 
> 
> Also, what is the proposed behavior with this?
> 
> 
> java -Xlog:class+load:file=log.txt -verbose:class -version
> 
> 
> Will we have [A]:
> 
> 
> class,load -> log.txt
> class,unload -> stdout
> 
> 
> or [B]?
> 
> 
> class,load -> log.txt
> class,unload -> disabled

For your java command:

java -Xlog:class+load:file=log.txt -verbose:class -version

We will have [B] according to the current commit:

class,load -> log.txt
class,unload -> disabled

But I'm not sure whether this behavior is correct. The website (https://docs.oracle.com/en/java/javase/16/docs/specs/man/java.html) doesn't give us explicit clue. It only says -verbose:class equals -Xlog:class+load=info,class+unload=info.
For the command above, maybe we can propose a third way [C]:

class,load -> log.txt and stdout
class,unload -> stdout

In addition, what if the command is:

java -Xlog:class+load=error,class+unload=info:log.txt -verbose:class -version

In this case, since ``class+load=error`` is ”weaker" than ``class+load=info``, maybe -verbose should not be overriden by -Xlog?
To make things simple, in my commit, as long as "class"  shows up, no matter it's ``-Xlog:class`` or ``-Xlog:class+resolve`` or ``-Xlog:class=debug``  , then ``-verbose:class`` is to be overiden. But I'm quite uncertain about whether it is correct. Looking forward to your suggestions.

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

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


More information about the hotspot-runtime-dev mailing list