< prev index next >

src/share/vm/logging/logConfiguration.cpp

Print this page
rev 11857 : imported patch 8150823


 226 
 227   // Update the decorators on all tagsets to get rid of unused decorators
 228   for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
 229     ts->update_decorators();
 230   }
 231 
 232   if (enabled) {
 233     assert(strlen(output->config_string()) > 0,
 234            "Should always have a config description if the output is enabled.");
 235   } else if (idx > 1) {
 236     // Output is unused and should be removed.
 237     delete_output(idx);
 238   } else {
 239     // Output is either stdout or stderr, which means we can't remove it.
 240     // Update the config description to reflect that the output is disabled.
 241     output->set_config_string("all=off");
 242   }
 243 }
 244 
 245 void LogConfiguration::disable_output(size_t idx) {

 246   LogOutput* out = _outputs[idx];
 247 
 248   // Remove the output from all tagsets.
 249   for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
 250     ts->set_output_level(out, LogLevel::Off);
 251     ts->update_decorators();
 252   }
 253 
 254   // Delete the output unless stdout/stderr
 255   if (out != LogOutput::Stderr && out != LogOutput::Stdout) {
 256     delete_output(find_output(out->name()));
 257   } else {
 258     out->set_config_string("all=off");
 259   }
 260 }
 261 
 262 void LogConfiguration::disable_logging() {
 263   ConfigurationLock cl;
 264   for (size_t i = 0; i < _n_outputs; i++) {
 265     disable_output(i);
 266   }
 267   notify_update_listeners();
 268 }
 269 
 270 void LogConfiguration::configure_stdout(LogLevelType level, bool exact_match, ...) {
 271   size_t i;
 272   va_list ap;
 273   LogTagLevelExpression expr;
 274   va_start(ap, exact_match);
 275   for (i = 0; i < LogTag::MaxTags; i++) {
 276     LogTagType tag = static_cast<LogTagType>(va_arg(ap, int));
 277     expr.add_tag(tag);
 278     if (tag == LogTag::__NO_TAG) {
 279       assert(i > 0, "Must specify at least one tag!");
 280       break;
 281     }
 282   }
 283   assert(i < LogTag::MaxTags || static_cast<LogTagType>(va_arg(ap, int)) == LogTag::__NO_TAG,
 284          "Too many tags specified! Can only have up to " SIZE_FORMAT " tags in a tag set.", LogTag::MaxTags);
 285   va_end(ap);




 226 
 227   // Update the decorators on all tagsets to get rid of unused decorators
 228   for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
 229     ts->update_decorators();
 230   }
 231 
 232   if (enabled) {
 233     assert(strlen(output->config_string()) > 0,
 234            "Should always have a config description if the output is enabled.");
 235   } else if (idx > 1) {
 236     // Output is unused and should be removed.
 237     delete_output(idx);
 238   } else {
 239     // Output is either stdout or stderr, which means we can't remove it.
 240     // Update the config description to reflect that the output is disabled.
 241     output->set_config_string("all=off");
 242   }
 243 }
 244 
 245 void LogConfiguration::disable_output(size_t idx) {
 246   assert(idx < _n_outputs, "invalid index: " SIZE_FORMAT " (_n_outputs: " SIZE_FORMAT ")", idx, _n_outputs);
 247   LogOutput* out = _outputs[idx];
 248 
 249   // Remove the output from all tagsets.
 250   for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
 251     ts->set_output_level(out, LogLevel::Off);
 252     ts->update_decorators();
 253   }
 254 
 255   // Delete the output unless stdout/stderr
 256   if (out != LogOutput::Stderr && out != LogOutput::Stdout) {
 257     delete_output(idx);
 258   } else {
 259     out->set_config_string("all=off");
 260   }
 261 }
 262 
 263 void LogConfiguration::disable_logging() {
 264   ConfigurationLock cl;
 265   for (size_t i = _n_outputs; i > 0; i--) {
 266     disable_output(i - 1);
 267   }
 268   notify_update_listeners();
 269 }
 270 
 271 void LogConfiguration::configure_stdout(LogLevelType level, bool exact_match, ...) {
 272   size_t i;
 273   va_list ap;
 274   LogTagLevelExpression expr;
 275   va_start(ap, exact_match);
 276   for (i = 0; i < LogTag::MaxTags; i++) {
 277     LogTagType tag = static_cast<LogTagType>(va_arg(ap, int));
 278     expr.add_tag(tag);
 279     if (tag == LogTag::__NO_TAG) {
 280       assert(i > 0, "Must specify at least one tag!");
 281       break;
 282     }
 283   }
 284   assert(i < LogTag::MaxTags || static_cast<LogTagType>(va_arg(ap, int)) == LogTag::__NO_TAG,
 285          "Too many tags specified! Can only have up to " SIZE_FORMAT " tags in a tag set.", LogTag::MaxTags);
 286   va_end(ap);


< prev index next >