RFR(S): 8198554: Add fuzzy matching for log levels and tags when parsing -Xlog

Marcus Larsson marcus.larsson at oracle.com
Fri Feb 23 09:29:19 UTC 2018


Hi Harold,

Thanks for reviewing!

On 2018-02-22 20:56, harold seigel wrote:
> Hi Marcus,
>
> This patch will be very helpful!
>
> Can you change code sequences like this in logSelection.cpp:
>
>    79 errstream->print("Invalid level '%s' in log selection.", levelstr);
>    80 LogLevelType match = LogLevel::fuzzy_match(levelstr);
>    81 if (match != LogLevel::Invalid) {
>    82 errstream->print(" Did you mean '%s'?", LogLevel::name(match));
>    83 }
>    84 errstream->cr();
>
> To something like this to lessen the chance of other threads' print 
> statements getting interspersed with this one?
>
>    if (match != LogLevel::Invalid) {
>        errstream->print_cr("Invalid level '%s' in log selection. Did
>    you mean '%'s?, levelstr, LogLevel::name(match));
>    } else {
>       errstream->print_cr("Invalid level '%s' in log selection.",
>    levelstr);
>    }
>

Actually, AFAICT these messages can't be interleaved as it's implemented 
right now. When we're parsing -Xlog arguments, the stream will be a 
stringStream (fully buffered). In the case of VM.log diagnostic command 
parsing, the stream will be tied to the output for whoever executes that 
DCMD, which I don't think can be interleaved by other threads. This 
assumption is used in other places around this code, so I'm hoping it's 
OK to leave it as is.

Thanks,
Marcus

> The rest of the patch looks good.
>
> Thanks, Harold
>
> On 2/22/2018 8:11 AM, Marcus Larsson wrote:
>> Hi,
>>
>> Please review the following patch to add some fuzzy matching to 
>> improve -Xlog parsing error messages. The implementation of the fuzzy 
>> -XX flag matching is moved out to StringUtils so it can be re-used here.
>>
>> Issue:
>> https://bugs.openjdk.java.net/browse/JDK-8198554
>>
>> Webrev:
>> http://cr.openjdk.java.net/~mlarsson/8198554/webrev.00
>>
>> Tested with hs-tier 1-2.
>>
>> Thanks,
>> Marcus
>>
>



More information about the hotspot-runtime-dev mailing list