GC日志记录:在Open JDK 14上,gc+meta选项不起作用。

huangapple go评论76阅读模式
英文:

GC logging : gc+meta option does not work on open jdk 14

问题

-Xlog:gc+meta*=trace,rt*=off:file=gcmetatrace.txt

我尝试使用上述选项启用GC日志记录。它不起作用。我正在使用JDK 13。meta选项在JDK 13中能工作吗?

英文:

-Xlog:gc+meta*=trace,rt*=off:file=gcmetatrace.txt

I tried using the above option to enable GC logging. It does not work. I am using JDK 13. Does meta option work with jdk 13?

答案1

得分: 1

我猜 meta 应该是 metadata,但我不知道 rt 应该代表什么。所有可用的标签可以通过 java -Xlog:help -version 列出,然后会有一个部分:Available log tags。请注意,并不是所有标签都可以单独使用(class 或者你的 metadata 不能)。

如果我去掉 rt(就像之前说的,我真的不知道这是什么意思),然后使用:

 "-Xlog:gc+meta*=trace:file=gcmetatrace.txt"

这将会失败,显示:

[0.006s][error][logging] 在日志选择中无效的标签 'meta'。你是不是想说 'metadata'?

我喜欢这个。虚拟机不知道有这样一个标签 meta,所以它失败了。建议是使用 metadata,让我们试试:

"-Xlog:gc+metadata*=trace:file=gcmetatrace.txt"

结果是:

[0.005s][warning][logging] 没有与选择匹配的标签集合:gc+metadata*。

问题是,并不是所有的标签都可以单独使用或以某些组合使用,gc+metadata 就是其中之一。不幸的是,这只是一个警告,JVM 进程仍会正常启动,但日志文件将为空(我希望它也能报错)。

所以,回答你的问题:meta 不受支持(甚至不存在),metadata 是受支持的,但不能单独使用。我不知道有没有一个命令可以列出所有标签组合的可用情况,但我可以建议你尝试:

"-Xlog:metadata=trace:file=gcmetatrace.txt"

这会产生一个警告,因为 metadata 不能单独使用,但它也会显示可能的组合(虽然不确定是否全部):

[0.003s][warning][logging] 没有与选择匹配的标签集合:metadata。你是不是想选择以下任意一个?metadata* jfr+metadata* jfr+system+metadata redefine+class+obsolete+metadata
英文:

I guess meta would be metadata, but I do not know what rt should stand for. All the available tags could be listed by java -Xlog:help -version and there will be a section: Available log tags. Just notice that not all tags can be used on their own (class or your metadata can't).

If I remove rt (as said, I don't really know what this is supposed to mean) and use:

 "-Xlog:gc+meta*=trace:file=gcmetatrace.txt"

it will fail with:

[0.006s][error][logging] Invalid tag 'meta' in log selection. Did you mean 'metadata'?

I like this. there is no such tag meta that the VM is aware of, as such it fails. The suggestion is to use metadata, let's try that:

"-Xlog:gc+metadata*=trace:file=gcmetatrace.txt"

The result is:

[0.005s][warning][logging] No tag set matches selection: gc+metadata*.

The problem is that not all tags can be used either individually or in some combinations and gc+metadata is one of those. Unfortunately, this is just a warning, the JVM process will start just fine, but the log file will be empty (I wish it would error out too).

So, to answer your question: meta is not supported (it does not even exist), metadata is supported, but not on its own. I am not aware of a command that would list all available combination of the tags, but I can suggest you could try:

 "-Xlog:metadata=trace:file=gcmetatrace.txt" 

This will provide a warning, since metadata is not supported on it's own, but that will also show the possible combinations (not sure if all, though):

[0.003s][warning][logging] No tag set matches selection: metadata. Did you mean any of the following? metadata* jfr+metadata* jfr+system+metadata redefine+class+obsolete+metadata

huangapple
  • 本文由 发表于 2020年4月10日 15:11:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/61135571.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定