8265047: Inconsistent warning message in jcmd VM.log

Reviewed-by: dholmes, stuefe, sspitsyn
This commit is contained in:
Koichi Sakata 2021-05-06 12:07:22 +00:00 committed by Thomas Stuefe
parent ea30bd6684
commit 51f5adfca3

View File

@ -427,6 +427,7 @@ bool LogConfiguration::parse_log_arguments(const char* outputstr,
ConfigurationLock cl;
size_t idx;
bool added = false;
if (outputstr[0] == '#') { // Output specified using index
int ret = sscanf(outputstr + 1, SIZE_FORMAT, &idx);
if (ret != 1 || idx >= _n_outputs) {
@ -447,9 +448,8 @@ bool LogConfiguration::parse_log_arguments(const char* outputstr,
LogOutput* output = new_output(normalized, output_options, errstream);
if (output != NULL) {
idx = add_output(output);
added = true;
}
} else if (output_options != NULL && strlen(output_options) > 0) {
errstream->print_cr("Output options for existing outputs are ignored.");
}
FREE_C_HEAP_ARRAY(char, normalized);
@ -457,6 +457,9 @@ bool LogConfiguration::parse_log_arguments(const char* outputstr,
return false;
}
}
if (!added && output_options != NULL && strlen(output_options) > 0) {
errstream->print_cr("Output options for existing outputs are ignored.");
}
configure_output(idx, selections, decorators);
notify_update_listeners();
selections.verify_selections(errstream);