< prev index next >
src/share/vm/logging/logConfiguration.cpp
Print this page
rev 8933 : 8046148.01
*** 39,64 ****
LogOutput** LogConfiguration::_outputs = NULL;
size_t LogConfiguration::_n_outputs = 0;
void LogConfiguration::post_initialize() {
assert(LogConfiguration_lock != NULL, "Lock must be initialized before post-initialization");
- LogDiagnosticCommand::registerCommand();
LogHandle(logging) log;
log.info("Log configuration fully initialized.");
if (log.is_trace()) {
ResourceMark rm;
- MutexLocker ml(LogConfiguration_lock);
describe(log.trace_stream());
}
}
void LogConfiguration::initialize(jlong vm_start_time) {
LogFileOutput::set_file_name_parameters(vm_start_time);
LogDecorations::set_vm_start_time_millis(vm_start_time);
assert(_outputs == NULL, "Should not initialize _outputs before this function, initialize called twice?");
! _outputs = NEW_C_HEAP_ARRAY(LogOutput*, 2, mtInternal);
_outputs[0] = LogOutput::Stdout;
_outputs[1] = LogOutput::Stderr;
_n_outputs = 2;
}
--- 39,63 ----
LogOutput** LogConfiguration::_outputs = NULL;
size_t LogConfiguration::_n_outputs = 0;
void LogConfiguration::post_initialize() {
assert(LogConfiguration_lock != NULL, "Lock must be initialized before post-initialization");
LogHandle(logging) log;
log.info("Log configuration fully initialized.");
if (log.is_trace()) {
ResourceMark rm;
describe(log.trace_stream());
}
+ LogDiagnosticCommand::registerCommand();
}
void LogConfiguration::initialize(jlong vm_start_time) {
LogFileOutput::set_file_name_parameters(vm_start_time);
LogDecorations::set_vm_start_time_millis(vm_start_time);
assert(_outputs == NULL, "Should not initialize _outputs before this function, initialize called twice?");
! _outputs = NEW_C_HEAP_ARRAY(LogOutput*, 2, mtLogging);
_outputs[0] = LogOutput::Stdout;
_outputs[1] = LogOutput::Stderr;
_n_outputs = 2;
}
*** 105,115 ****
return output;
}
size_t LogConfiguration::add_output(LogOutput* output) {
size_t idx = _n_outputs++;
! _outputs = REALLOC_C_HEAP_ARRAY(LogOutput*, _outputs, _n_outputs, mtInternal);
_outputs[idx] = output;
return idx;
}
void LogConfiguration::delete_output(size_t idx) {
--- 104,114 ----
return output;
}
size_t LogConfiguration::add_output(LogOutput* output) {
size_t idx = _n_outputs++;
! _outputs = REALLOC_C_HEAP_ARRAY(LogOutput*, _outputs, _n_outputs, mtLogging);
_outputs[idx] = output;
return idx;
}
void LogConfiguration::delete_output(size_t idx) {
*** 117,127 ****
err_msg("idx must be in range 1 < idx < _n_outputs, but idx = " SIZE_FORMAT
" and _n_outputs = " SIZE_FORMAT, idx, _n_outputs));
LogOutput* output = _outputs[idx];
// Swap places with the last output and shrink the array
_outputs[idx] = _outputs[--_n_outputs];
! _outputs = REALLOC_C_HEAP_ARRAY(LogOutput*, _outputs, _n_outputs, mtInternal);
delete output;
}
void LogConfiguration::configure_output(size_t idx, const LogTagLevelExpression& tag_level_expression, const LogDecorators& decorators) {
assert(idx < _n_outputs, err_msg("Invalid index, idx = " SIZE_FORMAT " and _n_outputs = " SIZE_FORMAT, idx, _n_outputs));
--- 116,126 ----
err_msg("idx must be in range 1 < idx < _n_outputs, but idx = " SIZE_FORMAT
" and _n_outputs = " SIZE_FORMAT, idx, _n_outputs));
LogOutput* output = _outputs[idx];
// Swap places with the last output and shrink the array
_outputs[idx] = _outputs[--_n_outputs];
! _outputs = REALLOC_C_HEAP_ARRAY(LogOutput*, _outputs, _n_outputs, mtLogging);
delete output;
}
void LogConfiguration::configure_output(size_t idx, const LogTagLevelExpression& tag_level_expression, const LogDecorators& decorators) {
assert(idx < _n_outputs, err_msg("Invalid index, idx = " SIZE_FORMAT " and _n_outputs = " SIZE_FORMAT, idx, _n_outputs));
*** 170,180 ****
disable_output(i);
}
}
bool LogConfiguration::parse_command_line_arguments(const char* opts) {
! char* copy = os::strdup_check_oom(opts, mtInternal);
// Split the option string to its colon separated components.
char* what = NULL;
char* output_str = NULL;
char* decorators_str = NULL;
--- 169,179 ----
disable_output(i);
}
}
bool LogConfiguration::parse_command_line_arguments(const char* opts) {
! char* copy = os::strdup_check_oom(opts, mtLogging);
// Split the option string to its colon separated components.
char* what = NULL;
char* output_str = NULL;
char* decorators_str = NULL;
*** 229,239 ****
return false;
}
} else {
idx = find_output(outputstr);
if (idx == SIZE_MAX) {
! char* tmp = os::strdup_check_oom(outputstr, mtInternal);
LogOutput* output = new_output(tmp, output_options);
os::free(tmp);
if (output == NULL) {
errstream->print("Unable to add output '%s'", outputstr);
if (output_options != NULL && strlen(output_options) > 0) {
--- 228,238 ----
return false;
}
} else {
idx = find_output(outputstr);
if (idx == SIZE_MAX) {
! char* tmp = os::strdup_check_oom(outputstr, mtLogging);
LogOutput* output = new_output(tmp, output_options);
os::free(tmp);
if (output == NULL) {
errstream->print("Unable to add output '%s'", outputstr);
if (output_options != NULL && strlen(output_options) > 0) {
< prev index next >