8150823: UL disables log outputs incorrectly
Reviewed-by: rehn, sla
This commit is contained in:
parent
ae70b68f7e
commit
10245a95e3
@ -243,6 +243,7 @@ void LogConfiguration::configure_output(size_t idx, const LogTagLevelExpression&
|
||||
}
|
||||
|
||||
void LogConfiguration::disable_output(size_t idx) {
|
||||
assert(idx < _n_outputs, "invalid index: " SIZE_FORMAT " (_n_outputs: " SIZE_FORMAT ")", idx, _n_outputs);
|
||||
LogOutput* out = _outputs[idx];
|
||||
|
||||
// Remove the output from all tagsets.
|
||||
@ -253,7 +254,7 @@ void LogConfiguration::disable_output(size_t idx) {
|
||||
|
||||
// Delete the output unless stdout/stderr
|
||||
if (out != LogOutput::Stderr && out != LogOutput::Stdout) {
|
||||
delete_output(find_output(out->name()));
|
||||
delete_output(idx);
|
||||
} else {
|
||||
out->set_config_string("all=off");
|
||||
}
|
||||
@ -261,8 +262,8 @@ void LogConfiguration::disable_output(size_t idx) {
|
||||
|
||||
void LogConfiguration::disable_logging() {
|
||||
ConfigurationLock cl;
|
||||
for (size_t i = 0; i < _n_outputs; i++) {
|
||||
disable_output(i);
|
||||
for (size_t i = _n_outputs; i > 0; i--) {
|
||||
disable_output(i - 1);
|
||||
}
|
||||
notify_update_listeners();
|
||||
}
|
||||
|
@ -164,10 +164,17 @@ TEST_F(LogConfigurationTest, disable_logging) {
|
||||
// Add TestLogFileName as an output
|
||||
set_log_config(TestLogFileName, "logging=info");
|
||||
|
||||
// Add a second file output
|
||||
char other_file_name[2 * K];
|
||||
jio_snprintf(other_file_name, sizeof(other_file_name), "%s-other", TestLogFileName);
|
||||
set_log_config(other_file_name, "logging=info");
|
||||
|
||||
LogConfiguration::disable_logging();
|
||||
|
||||
// Verify TestLogFileName was disabled
|
||||
// Verify that both file outputs were disabled
|
||||
EXPECT_FALSE(is_described(TestLogFileName));
|
||||
EXPECT_FALSE(is_described(other_file_name));
|
||||
delete_file(other_file_name);
|
||||
|
||||
// Verify that no tagset has logging enabled
|
||||
for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
|
||||
|
Loading…
Reference in New Issue
Block a user