mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8140556: Add force rotation option to VM.log jcmd
Rotate JVM log files via jcmd Reviewed-by: sla, mlarsson
This commit is contained in:
parent
6e0ea9d21c
commit
b8fd323a28
7 changed files with 56 additions and 12 deletions
|
@ -155,12 +155,7 @@ int LogFileOutput::write(const LogDecorations& decorations, const char* msg) {
|
|||
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;
|
||||
}
|
||||
|
@ -182,7 +177,14 @@ void LogFileOutput::archive() {
|
|||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue