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

Ioi Lam iklam at openjdk.java.net
Wed Sep 1 02:20:49 UTC 2021


On Mon, 30 Aug 2021 07:09:54 GMT, Xiaowei Lu <github.com+39413832+weixlu 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.

https://docs.oracle.com/en/java/javase/16/docs/specs/man/java.html only mentions that `-verbose:gc` will be overridden by `-Xloggc:<filename>` (and  `-Xloggc:<filename>` has been replaced with `-Xlog:gc:file=<filename>`). It doesn't mention the other three `-verbose` options (class, module, jni). We need to discuss what (if anything) should be done for those three options.

src/hotspot/share/runtime/arguments.cpp line 2963:

> 2961:     if (ts->contains(LogTag::_gc) && ts->has_output_to_file()) {
> 2962:       has_verbose_gc = false;
> 2963:     }

What if the command-line is this?


java -Xlog:gc+heap=foo.txt -verbose:gc -version

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

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

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


More information about the hotspot-runtime-dev mailing list