8273112: -Xloggc:<filename> should override -verbose:gc
Reviewed-by: iklam, dholmes
This commit is contained in:
parent
dd871819a0
commit
fa9c8657df
@ -72,7 +72,6 @@ char** Arguments::_jvm_args_array = NULL;
|
||||
int Arguments::_num_jvm_args = 0;
|
||||
char* Arguments::_java_command = NULL;
|
||||
SystemProperty* Arguments::_system_properties = NULL;
|
||||
const char* Arguments::_gc_log_filename = NULL;
|
||||
size_t Arguments::_conservative_max_heap_alignment = 0;
|
||||
Arguments::Mode Arguments::_mode = _mixed;
|
||||
bool Arguments::_java_compiler = false;
|
||||
@ -93,6 +92,8 @@ bool Arguments::_enable_preview = false;
|
||||
char* Arguments::SharedArchivePath = NULL;
|
||||
char* Arguments::SharedDynamicArchivePath = NULL;
|
||||
|
||||
LegacyGCLogging Arguments::_legacyGCLogging = { 0, 0 };
|
||||
|
||||
AgentLibraryList Arguments::_libraryList;
|
||||
AgentLibraryList Arguments::_agentList;
|
||||
|
||||
@ -2332,7 +2333,9 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
|
||||
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, load));
|
||||
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, unload));
|
||||
} else if (!strcmp(tail, ":gc")) {
|
||||
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc));
|
||||
if (_legacyGCLogging.lastFlag == 0) {
|
||||
_legacyGCLogging.lastFlag = 1;
|
||||
}
|
||||
} else if (!strcmp(tail, ":jni")) {
|
||||
LogConfiguration::configure_stdout(LogLevel::Debug, true, LOG_TAGS(jni, resolve));
|
||||
}
|
||||
@ -2739,7 +2742,8 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
|
||||
} else if (match_option(option, "-Xloggc:", &tail)) {
|
||||
// Deprecated flag to redirect GC output to a file. -Xloggc:<filename>
|
||||
log_warning(gc)("-Xloggc is deprecated. Will use -Xlog:gc:%s instead.", tail);
|
||||
_gc_log_filename = os::strdup_check_oom(tail);
|
||||
_legacyGCLogging.lastFlag = 2;
|
||||
_legacyGCLogging.file = os::strdup_check_oom(tail);
|
||||
} else if (match_option(option, "-Xlog", &tail)) {
|
||||
bool ret = false;
|
||||
if (strcmp(tail, ":help") == 0) {
|
||||
@ -3727,14 +3731,14 @@ bool Arguments::handle_deprecated_print_gc_flags() {
|
||||
log_warning(gc)("-XX:+PrintGCDetails is deprecated. Will use -Xlog:gc* instead.");
|
||||
}
|
||||
|
||||
if (_gc_log_filename != NULL) {
|
||||
if (_legacyGCLogging.lastFlag == 2) {
|
||||
// -Xloggc was used to specify a filename
|
||||
const char* gc_conf = PrintGCDetails ? "gc*" : "gc";
|
||||
|
||||
LogTarget(Error, logging) target;
|
||||
LogStream errstream(target);
|
||||
return LogConfiguration::parse_log_arguments(_gc_log_filename, gc_conf, NULL, NULL, &errstream);
|
||||
} else if (PrintGC || PrintGCDetails) {
|
||||
return LogConfiguration::parse_log_arguments(_legacyGCLogging.file, gc_conf, NULL, NULL, &errstream);
|
||||
} else if (PrintGC || PrintGCDetails || (_legacyGCLogging.lastFlag == 1)) {
|
||||
LogConfiguration::configure_stdout(LogLevel::Info, !PrintGCDetails, LOG_TAGS(gc));
|
||||
}
|
||||
return true;
|
||||
|
@ -51,6 +51,11 @@ struct SpecialFlag {
|
||||
JDK_Version expired_in; // When the option expires (or "undefined").
|
||||
};
|
||||
|
||||
struct LegacyGCLogging {
|
||||
const char* file; // NULL -> stdout
|
||||
int lastFlag; // 0 not set; 1 -> -verbose:gc; 2 -> -Xloggc
|
||||
};
|
||||
|
||||
// PathString is used as:
|
||||
// - the underlying value for a SystemProperty
|
||||
// - the path portion of an --patch-module module/path pair
|
||||
@ -317,8 +322,9 @@ class Arguments : AllStatic {
|
||||
// was this VM created via the -XXaltjvm=<path> option
|
||||
static bool _sun_java_launcher_is_altjvm;
|
||||
|
||||
// Option flags
|
||||
static const char* _gc_log_filename;
|
||||
// for legacy gc options (-verbose:gc and -Xloggc:)
|
||||
static LegacyGCLogging _legacyGCLogging;
|
||||
|
||||
// Value of the conservative maximum heap alignment needed
|
||||
static size_t _conservative_max_heap_alignment;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user