diff --git a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/impl/processors/AttributeUpdater.java b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/impl/processors/AttributeUpdater.java index 56ad594..a93cb12 100644 --- a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/impl/processors/AttributeUpdater.java +++ b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/impl/processors/AttributeUpdater.java @@ -12,10 +12,12 @@ import me.tongfei.progressbar.ProgressBarStyle; import java.io.File; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; @Slf4j public abstract class AttributeUpdater { @@ -88,12 +90,12 @@ public abstract class AttributeUpdater { if (config.isSafeMode()) return; try { + log.info("Committing changes [{}] to {}", changeLog(fileInfo), fileInfo.getFile().getPath()); fileProcessor.update(fileInfo); statistic.changeSuccessful(); - log.info("Commited {} to '{}'", fileInfo.getMatchedConfig().toStringShort(), fileInfo.getFile().getPath()); } catch (IOException | MkvToolNixException e) { statistic.changeFailed(); - log.warn("Couldn't commit {} to '{}'", fileInfo.getMatchedConfig().toStringShort(), fileInfo.getFile().getPath(), e); + log.warn("Couldn't commit changes [{}] to {}", changeLog(fileInfo), fileInfo.getFile().getPath(), e); } } else if (fileInfo.getChanges().isEmpty()) { statistic.unchanged(); @@ -102,6 +104,15 @@ public abstract class AttributeUpdater { } } + private String changeLog(FileInfo fileInfo) { + List changes = new ArrayList<>(); + if (fileInfo.getMatchedConfig() != null) changes.add("defaults " + fileInfo.getMatchedConfig().toStringShort()); + if (!fileInfo.getChanges().getForcedTrack().isEmpty()) changes.add("forced tags"); + if (!fileInfo.getChanges().getCommentaryTrack().isEmpty()) changes.add("commentary tags"); + if (!fileInfo.getChanges().getHearingImpairedTrack().isEmpty()) changes.add("hearing impaired tags"); + return String.join(", ", changes); + } + // should this be here? // protected void writeLastExecutionDate() { // if (config.isSafeMode()) { diff --git a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/impl/processors/CoherentAttributeUpdater.java b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/impl/processors/CoherentAttributeUpdater.java index 5f13ea1..24e356c 100644 --- a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/impl/processors/CoherentAttributeUpdater.java +++ b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/impl/processors/CoherentAttributeUpdater.java @@ -47,6 +47,7 @@ public class CoherentAttributeUpdater extends SingleFileAttributeUpdater { matchedFiles.size(), files.size(), rootDir.getPath()); } + log.info("Found coherent match {} for {}", matchedConfig.toStringShort(), rootDir.getPath()); matchedFiles.forEach(fileInfo -> { attributeChangeProcessor.findForcedTracksAndApplyChanges(fileInfo, this.config.isOverwriteForced()); attributeChangeProcessor.findCommentaryTracksAndApplyChanges(fileInfo); @@ -64,12 +65,12 @@ public class CoherentAttributeUpdater extends SingleFileAttributeUpdater { }); if (config.isForceCoherent()) { - log.info("No coherent match found, aborting: {}", rootDir.getPath()); + log.info("No coherent match found, skipping {}", rootDir.getPath()); statistic.increaseUnchangedBy(files.size()); return; } - log.info("No coherent match found, trying to find coherent match in child directories: {}", rootDir.getPath()); + log.info("No coherent match found, attempting to find coherent match in child directories of {}", rootDir.getPath()); for (File dir: fileProcessor.loadDirectory(rootDir.getPath(), 1)) this.process(dir); } @@ -83,7 +84,7 @@ public class CoherentAttributeUpdater extends SingleFileAttributeUpdater { fileInfo.setMatchedConfig(null); if (fileInfo.getTracks().isEmpty()) { - log.warn("No attributes found for file {}", file); + log.warn("No attributes found for {}", file); statistic.unknownFailed(); break; } diff --git a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/impl/processors/SingleFileAttributeUpdater.java b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/impl/processors/SingleFileAttributeUpdater.java index 7c4c283..0d28a08 100644 --- a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/impl/processors/SingleFileAttributeUpdater.java +++ b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/impl/processors/SingleFileAttributeUpdater.java @@ -31,7 +31,7 @@ public class SingleFileAttributeUpdater extends AttributeUpdater { FileInfo fileInfo = fileProcessor.readAttributes(file); if (fileInfo.getTracks().isEmpty()) { - log.warn("No attributes found for file {}", file); + log.warn("No attributes found for {}", file); statistic.unknownFailed(); return; } diff --git a/src/main/resources/log4j2-debian.yaml b/src/main/resources/log4j2-debian.yaml index 4312257..1ad3cd5 100644 --- a/src/main/resources/log4j2-debian.yaml +++ b/src/main/resources/log4j2-debian.yaml @@ -6,7 +6,7 @@ Configuration: fileName: ${sys:user.home}/.local/mkvaudiosubtitlechanger/logs/application.log filePattern: ${sys:user.home}/.local/mkvaudiosubtitlechanger/logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz PatternLayout: - Pattern: "%d{DEFAULT} | %-5level | %thread | %C{1} | %msg %n %throwable" + Pattern: "%d{DEFAULT} | %-5level | %msg %n %throwable" ThresholdFilter: level: debug Policies: diff --git a/src/main/resources/log4j2-windows.yaml b/src/main/resources/log4j2-windows.yaml index d14055c..e39795f 100644 --- a/src/main/resources/log4j2-windows.yaml +++ b/src/main/resources/log4j2-windows.yaml @@ -6,7 +6,7 @@ Configuration: fileName: ${sys:user.home}/AppData/Local/MKVAudioSubtitleChanger/logs/application.log filePattern: ${sys:user.home}/AppData/Local/MKVAudioSubtitleChanger/logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz PatternLayout: - Pattern: "%d{DEFAULT} | %-5level | %thread | %C{1} | %msg %n %throwable" + Pattern: "%d{DEFAULT} | %-5level | %msg %n %throwable" ThresholdFilter: level: debug Policies: diff --git a/src/main/resources/log4j2.yaml b/src/main/resources/log4j2.yaml index 182ad50..b909c8d 100644 --- a/src/main/resources/log4j2.yaml +++ b/src/main/resources/log4j2.yaml @@ -6,7 +6,7 @@ Configuration: fileName: logs/application.log filePattern: logs/archive/application-%d{yyyy-MM-dd}-%i.log.gz PatternLayout: - Pattern: "%d{DEFAULT} | %-5level | %thread | %C{1} | %msg %n %throwable" + Pattern: "%d{DEFAULT} | %-5level | %msg %n %throwable" ThresholdFilter: level: debug Policies: