RFR: 8271186: Add UL option to replace newline char [v4]

Ioi Lam iklam at openjdk.java.net
Wed Aug 25 01:25:23 UTC 2021


On Wed, 25 Aug 2021 01:07:29 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/share/logging/logConfiguration.cpp line 577:
>> 
>>> 575:                                          " Escape newline (\\n) and backslash (\\) characters in the UL output"
>>> 576:                                          " if it is set to true."
>>> 577:                                          " Note that it works on file output only.");
>> 
>> How about this message?
>> 
>> 
>> out->print_cr("   foldmultilines=.. - If set to true, a log event that consists of multiple lines"
>>                                        " will be folded into a single line by escaping"
>>                                        " the newline (\\n) and backslash (\) characters"
>>                                        " in the output.")
>> 
>> I think there's no need to say "it works on file output only" because this is under the heading of "Additional output-options for file outputs".
>
> We are not "escaping" newline characters here. We went through great pains in the CSR request to describe the actual process accurately. We are replacing newlines with the sequence `` and `n`. We also have to replace `` with the sequence `\` so that the conversion can be reversed by a parser. Saying all this in the help output is awkward but necessary. We also need to warn that this may not be safe with character encodings other than UTF-8. So something like:
> 
> `If set to true, a log event that consists of multiple lines will be folded into a single line by replacing newline characters with the sequence '' and 'n' in the output. Existing single backslash characters will also be replaced with a sequence of two backslashes so that the conversion can be reversed. This option is safe to use with UTF-8 character encodings, but other encodings may not work.`

Ok, this version is much better than mine :-)

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

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


More information about the hotspot-runtime-dev mailing list