Integrated: 8244190: JFR: When starting a JVM with -XX:StartFlightRecording, output is written to stdout
Erik Gahlin
egahlin at openjdk.java.net
Fri Apr 16 17:30:44 UTC 2021
On Fri, 9 Apr 2021 15:24:52 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:
> Hi,
>
> Could I have review of a change that makes it possible to silence the output of JFR during startup. That is:
>
> "Started recording 1. No limit specified, using maxsize=250MB as default.
>
> Use jcmd 38045 JFR.dump name=1 filename=FILEPATH to copy recording data to file"
>
> There are severals ways to approach this:
>
> 1) Remove the output completely
> - Con: Users will think JFR is not working since they are used to see the output
> - Con: The PID must be found by other means
> - Con: No hint about jcmd, or disk space being used
>
> 2) Introduce a flag to silence the output, i.e. -XX:StartFlightRecording:silent=true
> - Con: Users must read documentation to find out about the option
> - Con: It introduces a second mechanism to control logging
> - Pro: Easy to backport. No behavioral change.
>
> 3) Write to unified logging with level Info
> - Con: Users will think JFR is not working since they are used to see the output
> - Con: The PID must be found by other means
> - Con: No hint about jcmd, or disk space being used
> - Con: Users must read documentation to find out about -Xlog:jfr+startup=info
>
> 4) Write to unified logging with level Warning
> - Con: Confusing since it is not a warning.
> - Pro: Users can see the tag set and turn it off easily using -Xlog:jfr+startup=off/error
>
> 5) If -XX:StartFlightRecording has been specified, set jfr+startup=Info temporarily and write with level Info.
> - Con: If user has specified -Xlog:jfr+startup=warning it will not take effect.
> - Pro: Users can see the tag set and turn it off easily using -Xlog:jfr+startup=off/error
>
> One could try to detect if the user has set the level to jfr+startup=warning and not change the level to Info in those cases. Unfortunately there is no mechanism in UL to see if a tag set has been touched and one would need to take into account there could be several types of output, i.e. files, that can be touched. It becomes complicated.
>
> I have chosen to implement 5. It's not perfect, but perhaps sufficient for now? Detection of -Xlog:jfr+startup=warning could be added in the future if there is a need.
>
> $ java -XX:StartFlightRecording -version
> [0.385s][info][jfr,startup] Started recording 1. No limit specified, using maxsize=250MB as default.
> [0.385s][info][jfr,startup]
> [0.385s][info][jfr,startup] Use jcmd 7469 JFR.dump name=1 filename=FILEPATH to copy recording data to file.
>
> $ java -XX:StartFlightRecording:settings=foo.bar -version
> [0.174s][error][jfr,startup] Could not parse settings file 'foo.bar'
>
> Testing: jdk/jdk/jfr, tier1-tier4
>
> Thanks
> Erik
This pull request has now been integrated.
Changeset: 7c37c022
Author: Erik Gahlin <egahlin at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/7c37c022
Stats: 170 lines in 11 files changed: 130 ins; 7 del; 33 mod
8244190: JFR: When starting a JVM with -XX:StartFlightRecording, output is written to stdout
Reviewed-by: mgronlun
-------------
PR: https://git.openjdk.java.net/jdk/pull/3417
More information about the hotspot-jfr-dev
mailing list