Browse Source

REPORT-42043 fanruan.log无法分割-多线程问题

bokai 4 years ago
parent
commit
af4fb4b14d
  1. 8
      fine-log4j/src/main/java/com/fr/third/apache/log4j/DailyRollingFileAppender.java

8
fine-log4j/src/main/java/com/fr/third/apache/log4j/DailyRollingFileAppender.java

@ -320,6 +320,10 @@ public class DailyRollingFileAppender extends FileAppender {
if (scheduledFilename.equals(datedFilename)) {
return;
}
synchronized (this) {
if (scheduledFilename.equals(datedFilename)) {
return;
}
// close current file, and compress it to datedFilename
this.closeFile();
@ -372,12 +376,12 @@ public class DailyRollingFileAppender extends FileAppender {
// This will also close the file. This is OK since multiple
// close operations are safe.
this.setFile(fileName, true, this.bufferedIO, this.bufferSize);
}
catch(IOException e) {
} catch (IOException e) {
errorHandler.error("setFile(" + fileName + ", true) call failed.");
}
scheduledFilename = datedFilename;
}
}
/**

Loading…
Cancel
Save