8145235: Deprecate product flags that have been converted to Unified Logging
Summary: Added deprecation message/mechanism for product flags aliased to Unified Logging options
Reviewed-by: mockner, coleenp, ddmitriev, mlarsson
--- a/hotspot/src/share/vm/logging/logTag.hpp Thu Mar 31 11:21:20 2016 +0000
+++ b/hotspot/src/share/vm/logging/logTag.hpp Thu Mar 31 12:06:51 2016 -0400
@@ -34,6 +34,7 @@
#define LOG_TAG_LIST \
LOG_TAG(alloc) \
LOG_TAG(age) \
+ LOG_TAG(arguments) \
LOG_TAG(barrier) \
LOG_TAG(biasedlocking) \
LOG_TAG(bot) \
--- a/hotspot/src/share/vm/runtime/arguments.cpp Thu Mar 31 11:21:20 2016 +0000
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Thu Mar 31 12:06:51 2016 -0400
@@ -994,10 +994,35 @@
return NULL;
}
-AliasedLoggingFlag Arguments::catch_logging_aliases(const char* name){
+void log_deprecated_flag(const char* name, bool on, AliasedLoggingFlag alf) {
+ LogTagType tagSet[] = {alf.tag0, alf.tag1, alf.tag2, alf.tag3, alf.tag4, alf.tag5};
+ // Set tagset string buffer at max size of 256, large enough for any alias tagset
+ const int max_tagset_size = 256;
+ int max_tagset_len = max_tagset_size - 1;
+ char tagset_buffer[max_tagset_size];
+ tagset_buffer[0] = '\0';
+
+ // Write tag-set for aliased logging option, in string list form
+ int max_tags = sizeof(tagSet)/sizeof(tagSet[0]);
+ for (int i = 0; i < max_tags && tagSet[i] != LogTag::__NO_TAG; i++) {
+ if (i > 0) {
+ strncat(tagset_buffer, ",", max_tagset_len - strlen(tagset_buffer));
+ }
+ strncat(tagset_buffer, LogTag::name(tagSet[i]), max_tagset_len - strlen(tagset_buffer));
+ }
+
+ log_warning(arguments)("-XX:%s%s is deprecated. Will use -Xlog:%s=%s instead.",
+ (on) ? "+" : "-",
+ name,
+ tagset_buffer,
+ (on) ? LogLevel::name(alf.level) : "off");
+}
+
+AliasedLoggingFlag Arguments::catch_logging_aliases(const char* name, bool on){
for (size_t i = 0; aliased_logging_flags[i].alias_name != NULL; i++) {
const AliasedLoggingFlag& alf = aliased_logging_flags[i];
if (strcmp(alf.alias_name, name) == 0) {
+ log_deprecated_flag(name, on, alf);
return alf;
}
}
@@ -1016,7 +1041,7 @@
bool warn_if_deprecated = true;
if (sscanf(arg, "-%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) {
- AliasedLoggingFlag alf = catch_logging_aliases(name);
+ AliasedLoggingFlag alf = catch_logging_aliases(name, false);
if (alf.alias_name != NULL){
LogConfiguration::configure_stdout(LogLevel::Off, alf.exactMatch, alf.tag0, alf.tag1, alf.tag2, alf.tag3, alf.tag4, alf.tag5);
return true;
@@ -1028,7 +1053,7 @@
return set_bool_flag(real_name, false, origin);
}
if (sscanf(arg, "+%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) {
- AliasedLoggingFlag alf = catch_logging_aliases(name);
+ AliasedLoggingFlag alf = catch_logging_aliases(name, true);
if (alf.alias_name != NULL){
LogConfiguration::configure_stdout(alf.level, alf.exactMatch, alf.tag0, alf.tag1, alf.tag2, alf.tag3, alf.tag4, alf.tag5);
return true;
@@ -1244,8 +1269,9 @@
else {
const char* replacement;
if ((replacement = removed_develop_logging_flag_name(stripped_argname)) != NULL){
- jio_fprintf(defaultStream::error_stream(),
- "%s has been removed. Please use %s instead.\n", stripped_argname, replacement);
+ log_warning(arguments)("%s has been removed. Please use %s instead.",
+ stripped_argname,
+ replacement);
return false;
}
}
--- a/hotspot/src/share/vm/runtime/arguments.hpp Thu Mar 31 11:21:20 2016 +0000
+++ b/hotspot/src/share/vm/runtime/arguments.hpp Thu Mar 31 12:06:51 2016 -0400
@@ -526,7 +526,7 @@
// Return NULL if the arg has expired.
static const char* handle_aliases_and_deprecation(const char* arg, bool warn);
static bool lookup_logging_aliases(const char* arg, char* buffer);
- static AliasedLoggingFlag catch_logging_aliases(const char* name);
+ static AliasedLoggingFlag catch_logging_aliases(const char* name, bool on);
static short CompileOnlyClassesNum;
static short CompileOnlyClassesMax;
static char** CompileOnlyClasses;