< prev index next >

src/share/vm/logging/logFileOutput.cpp

Print this page

        

@@ -153,16 +153,11 @@
     return 0;
   }
   int written = LogFileStreamOutput::write(decorations, msg);
   _current_size += written;
 
-  if (should_rotate()) {
-    MutexLockerEx ml(&_rotation_lock, true /* no safepoint check */);
-    if (should_rotate()) {
-      rotate();
-    }
-  }
+  rotate(false);
 
   return written;
 }
 
 void LogFileOutput::archive() {

@@ -180,11 +175,18 @@
     jio_fprintf(defaultStream::error_stream(), "Could not rename log file '%s' to '%s' (%s).\n",
                 _file_name, _archive_name, strerror(errno));
   }
 }
 
-void LogFileOutput::rotate() {
+void LogFileOutput::rotate(bool force) {
+
+  if (!should_rotate(force)) {
+    return;
+  }
+
+  MutexLockerEx ml(&_rotation_lock, true /* no safepoint check */);
+
   // Archive the current log file
   archive();
 
   // Open the active log file using the same stream as before
   _stream = freopen(_file_name, FileOpenMode, _stream);
< prev index next >