How to get reference processing logging?
thomas.schatzl at oracle.com
Wed Dec 7 12:20:15 UTC 2016
On Wed, 2016-12-07 at 11:26 +0000, Andrew Haley wrote:
> On 07/12/16 11:15, Thomas Schatzl wrote:
> > Hi,
> > On Wed, 2016-12-07 at 11:08 +0000, Andrew Haley wrote:
> > >
> > > I've tried "-Xlog:gc::ref" and "-Xlog:gc=ref" but neither works.
> > "-Xlog:gc+ref=debug"
> > >
> > >
> > > I want to see this output:
> > >
> > > log_debug(gc, ref)("Ref Counts: Soft: " SIZE_FORMAT " Weak: "
> > > SIZE_FORMAT " Final: " SIZE_FORMAT " Phantom: " SIZE_FORMAT,
> > > stats.soft_count(), stats.weak_count(),
> > > stats.final_count(), stats.phantom_count());
> > > log_develop_trace(gc, ref)("JNI Weak Reference count: "
> > > SIZE_FORMAT, count_jni_refs());
> > >
> > >
> > > I tried -Xlog:help and searc hed on the web for information about
> > > the
> > > -Xlog syntax, but no luck.
> > -Xlog:help gives a pretty comprehensive output with BNF syntax
> > description here. It also includes a lot of examples.
> Perhaps, but none of the examples actually contain "+".
http://openjdk.java.net/jeps/158 contains even more comprehensive
I filed JDK-8170855, you are right.
> > Particularly the sentence below the BNF string gives an explanation
> > of "what" should be.
> > Maybe you have some suggestions to improve the text?
> Indeed I do. An example which contains the crucial "+" would be a
> Like this:
> Log messages tagged with 'gc' and 'ref' tags using 'debug'
> level to stdout, with default decorations.
> The crucial I didn't realize was that in
> log_debug(gc, ref)
> both "gc" and "ref" are tags. It's not obvious, but I suppose if I'd
> studied the way the logging framework is called it would have been
> clearer. Nonethless, you shouldn't have to be a developer who knows
> the logging API just in order to get some log output, and the syntax
> is very obscure.
I think in this case looking at the use in the sources maybe
contributed to the confusion. I.e. you might come to the conclusion
that "gc" is not a tag?
The usage string seems clear in that "what" is "... a combination of
tags and levels on [I think this is a typo] the form
tag1[+tag2][*]=level", with a set of available tags further below.
> Is this stuff documented anywhere?
Somebody from the serviceability team can probably tell you more about
the location of a official documentation.
As for documentation of the various tags, and what they print in
particular, I do not think there is one (apart from the sources). Maybe
somebody else can give you more insights.
My suggestion is to start off with e.g. gc*=debug/all=debug and from
that create a set of messages you need (or if you are a dev look at the
source code for the message you want).
More information about the hotspot-gc-dev