This commit is contained in:
@@ -113,15 +113,18 @@ public class LogFileHandler extends Handler {
|
|||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
LogRecord record = records.take();
|
LogRecord record = records.take();
|
||||||
if ((limit > 0 && limit <= length.get()) || tomorrow <= record.getMillis()) {
|
final boolean bigger = (limit > 0 && limit <= length.get());
|
||||||
|
if (bigger || tomorrow <= record.getMillis()) {
|
||||||
updateTomorrow();
|
updateTomorrow();
|
||||||
if (stream != null) {
|
if (stream != null) {
|
||||||
stream.close();
|
stream.close();
|
||||||
for (int i = Math.min(count - 2, index.get() - 1); i > 0; i--) {
|
if (bigger) {
|
||||||
File greater = new File(logfile.getPath() + "." + i);
|
for (int i = Math.min(count - 2, index.get() - 1); i > 0; i--) {
|
||||||
if (greater.exists()) Files.move(greater.toPath(), new File(logfile.getPath() + "." + (i + 1)).toPath(), REPLACE_EXISTING, ATOMIC_MOVE);
|
File greater = new File(logfile.getPath() + "." + i);
|
||||||
|
if (greater.exists()) Files.move(greater.toPath(), new File(logfile.getPath() + "." + (i + 1)).toPath(), REPLACE_EXISTING, ATOMIC_MOVE);
|
||||||
|
}
|
||||||
|
Files.move(logfile.toPath(), new File(logfile.getPath() + ".1").toPath(), REPLACE_EXISTING, ATOMIC_MOVE);
|
||||||
}
|
}
|
||||||
Files.move(logfile.toPath(), new File(logfile.getPath() + ".1").toPath(), REPLACE_EXISTING, ATOMIC_MOVE);
|
|
||||||
stream = null;
|
stream = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user