调整日志收集

This commit is contained in:
zlzw 2022-11-12 17:08:58 +08:00
parent 8455c360fc
commit e52ec4a2b8
2 changed files with 2 additions and 2 deletions

View File

@ -43,7 +43,7 @@ public class LogUtils {
if (dir.listFiles() != null) { if (dir.listFiles() != null) {
for (File file : dir.listFiles()) { for (File file : dir.listFiles()) {
if (file.getName().endsWith(".log") && !"error.log".equals(file.getName())) { if (file.getName().endsWith(".log") && !"error.log".equals(file.getName())) {
String fileName = file.getName().replace(title, "").replace(".log", ""); String fileName = file.getName().replace(".log", "").split("_")[1];
if (isDelLog(fileName)) { if (isDelLog(fileName)) {
file.delete(); file.delete();
} }

View File

@ -165,7 +165,7 @@ public class LogUtil {
WritableByteChannel writableByteChannel = Channels.newChannel(zos); WritableByteChannel writableByteChannel = Channels.newChannel(zos);
if (dir.listFiles() != null) { if (dir.listFiles() != null) {
for (File file : dir.listFiles()) { for (File file : dir.listFiles()) {
if (file.getName().endsWith(".log") && !"error.log".equals(file.getName())) { if (file.getName().endsWith(".log")) {
ZipEntry entry = new ZipEntry(file.getName()); ZipEntry entry = new ZipEntry(file.getName());
zos.putNextEntry(entry); zos.putNextEntry(entry);
fis = new FileInputStream(file); fis = new FileInputStream(file);