< prev index next >
src/share/vm/logging/logFileOutput.cpp
Print this page
*** 153,168 ****
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();
! }
! }
return written;
}
void LogFileOutput::archive() {
--- 153,163 ----
return 0;
}
int written = LogFileStreamOutput::write(decorations, msg);
_current_size += written;
! rotate(false);
return written;
}
void LogFileOutput::archive() {
*** 180,190 ****
jio_fprintf(defaultStream::error_stream(), "Could not rename log file '%s' to '%s' (%s).\n",
_file_name, _archive_name, strerror(errno));
}
}
! void LogFileOutput::rotate() {
// Archive the current log file
archive();
// Open the active log file using the same stream as before
_stream = freopen(_file_name, FileOpenMode, _stream);
--- 175,192 ----
jio_fprintf(defaultStream::error_stream(), "Could not rename log file '%s' to '%s' (%s).\n",
_file_name, _archive_name, strerror(errno));
}
}
! 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 >