RFR: 8273104: Refactoring option parser for UL [v2]
Yasumasa Suenaga
ysuenaga at openjdk.java.net
Tue Sep 7 01:58:39 UTC 2021
On Tue, 7 Sep 2021 01:43:03 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
>> As we discussed in PR #4885 and in [its CSR](https://bugs.openjdk.java.net/browse/JDK-8271188), we want to introduce `foldmultilines` to stdout/err UL output. However we have no chance to configure `LogOutput` for stdout/err (`LogStdoutOutput`/`LogStderrOutput`) becasuse they will be instantiated statically in logFileStreamOutput.cpp.
>>
>> So we need to refactor UL option parser to propagate options to all extended classes of `LogOutput`.
>>
>> * Move `parse_option()` to `LogOutput` from `LogFileOutput`, then it becames public member.
>> * Introduce `set_option()` in `LogOutput` as a pure virtual member to apply options to each log output, then it is implemented in both `LogFileStreamOutput` and `LogFileOutput`.
>> * Move both `FoldMultilinesOptionKey` and `_fold_mulilines` in `LogFileStreamOutput` to private member because they are no longer to need to be public.
>>
>> I want to send PR to introduce `foldmultilines` to stdout/err like https://github.com/YaSuenag/jdk/compare/ul-refactoring...YaSuenag:foldmultilines-for-stdout after this.
>
> Yasumasa Suenaga has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix condition for error stream
Thanks David for the comment!
> IIUC these dynamic changes to the options will only apply after argument processing is complete
All of output options can't be changed dynamically. We can see following error when we attempt to do so.
As you said UL for stdout/err can be used before argument processing, however file output isn't so. All of argument processing can be happened at `LogFileOutput::initialize()` and it would call `parse_options()`.
$ jcmd 62838 VM.log list
<snip>
Log output configuration:
#0: stdout all=warning uptime,level,tags
#1: stderr all=off uptime,level,tags
#2: file=test.log all=info uptime,level,tags filecount=5,filesize=20480K,async=false (reconfigured)
$ jcmd 62838 VM.log output=#2 output_options=foldmultilines=true
62838:
Output options for existing outputs are ignored.
(I can see `reconfigured` label in JDK 16 even if any output options are not accepted from jcmd - it may be bug)
-------------
PR: https://git.openjdk.java.net/jdk/pull/5293
More information about the hotspot-runtime-dev
mailing list