< prev index next >

src/share/vm/logging/logConfiguration.cpp

Print this page

        

@@ -33,10 +33,11 @@
 #include "logging/logTagSet.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "runtime/os.inline.hpp"
 #include "utilities/globalDefinitions.hpp"
+#include "utilities/defaultStream.hpp"
 
 LogOutput** LogConfiguration::_outputs = NULL;
 size_t      LogConfiguration::_n_outputs = 0;
 
 void LogConfiguration::post_initialize() {

@@ -349,5 +350,23 @@
 
               " -Xlog:disable -Xlog:rt=trace:rttrace.txt\n"
               "\t Turn off all logging, including warnings and errors,\n"
               "\t and then enable messages tagged with 'rt' using 'trace' level to file 'rttrace.txt'.\n");
 }
+
+void LogConfiguration::rotate_all_logfile() {
+  for (size_t idx = 0; idx < _n_outputs; idx++) {
+    if ((strcmp(_outputs[idx]->name(), "stdout") != 0) &&
+        (strcmp(_outputs[idx]->name(), "stderr") != 0)) {
+      LogFileOutput *logger = (LogFileOutput *)_outputs[idx];
+
+      if (logger->get_archive_name() == NULL) {
+       jio_fprintf(defaultStream::error_stream(),
+        "Could not rotate log file '%s' because filecount option is not set.\n",
+                                                                logger->name());
+      } else {
+        logger->rotate();
+      }
+    }
+  }
+}
+
< prev index next >