Browse Source

REPORT-42043 fanruan.log无法分割-代码质量

release/10.0
bokai 4 years ago
parent
commit
f719507914
  1. 6
      fine-log4j/src/main/java/com/fr/third/apache/log4j/DailyRollingFileAppender.java

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

@ -330,7 +330,7 @@ public class DailyRollingFileAppender extends FileAppender {
}
File file = new File(fileName);
boolean result = false;
boolean isGzipSuccess = false;
try (FileInputStream fis = new FileInputStream(file);
FileOutputStream fos = new FileOutputStream(target);
@ -341,14 +341,14 @@ public class DailyRollingFileAppender extends FileAppender {
while ((n = fis.read(inbuf)) != -1) {
gzos.write(inbuf, 0, n);
}
result = true;
isGzipSuccess = true;
} catch (Exception e) {
LogLog.error("Compress " + fileName + " to " + scheduledFilename + " failed.");
LogLog.error(e.getMessage(), e);
}
boolean isDeleteSuccess = true;
if (result) {
if (isGzipSuccess) {
isDeleteSuccess = file.delete();
LogLog.debug(fileName + " -> " + scheduledFilename);
} else {

Loading…
Cancel
Save