diff --git a/src/main/java/org/cryptomator/cryptofs/CryptoFileSystemModule.java b/src/main/java/org/cryptomator/cryptofs/CryptoFileSystemModule.java index 35f52ee3..01b21154 100644 --- a/src/main/java/org/cryptomator/cryptofs/CryptoFileSystemModule.java +++ b/src/main/java/org/cryptomator/cryptofs/CryptoFileSystemModule.java @@ -39,7 +39,7 @@ public Optional provideNativeFileStore(@PathToVault Path pathToVault) try { return Optional.of(Files.getFileStore(pathToVault)); } catch (IOException e) { - LOG.warn("Failed to get file store for " + pathToVault, e); + LOG.warn("Failed to get file store for {}", pathToVault, e); return Optional.empty(); } } @@ -52,7 +52,7 @@ public Consumer provideFilesystemEventConsumer(CryptoFileSystem try { eventConsumer.accept(event); } catch (RuntimeException e) { - LOG.warn("Filesystem event consumer failed with exception when processing event {}", event, e); + LOG.warn("Filesystem event consumer failed with exception when processing event {}", event.getClass().getSimpleName(), e); } }; } diff --git a/src/main/java/org/cryptomator/cryptofs/CryptoFileSystems.java b/src/main/java/org/cryptomator/cryptofs/CryptoFileSystems.java index 5810626d..ef312368 100644 --- a/src/main/java/org/cryptomator/cryptofs/CryptoFileSystems.java +++ b/src/main/java/org/cryptomator/cryptofs/CryptoFileSystems.java @@ -97,7 +97,7 @@ private String readVaultConfigFile(Path pathToVault, CryptoFileSystemProperties // TODO: remove this check and tell downstream users to check the vault dir structure before creating a CryptoFileSystemImpl @SuppressWarnings("deprecation") var masterkeyFilename = properties.masterkeyFilename(); if (masterkeyFilename != null && Files.exists(pathToVault.resolve(masterkeyFilename))) { - LOG.warn("Failed to read {}, but found {}}", vaultConfigFile, masterkeyFilename); + LOG.warn("Failed to read {}, but found {}", vaultConfigFile, masterkeyFilename); throw new FileSystemNeedsMigrationException(pathToVault); } else { throw e; diff --git a/src/main/java/org/cryptomator/cryptofs/CryptoPathMapper.java b/src/main/java/org/cryptomator/cryptofs/CryptoPathMapper.java index 8851643b..e272cdfd 100644 --- a/src/main/java/org/cryptomator/cryptofs/CryptoPathMapper.java +++ b/src/main/java/org/cryptomator/cryptofs/CryptoPathMapper.java @@ -105,7 +105,7 @@ public CiphertextFileType getCiphertextFileType(CryptoPath cleartextPath) throws return CiphertextFileType.FILE; } else { eventConsumer.accept(new BrokenFileNodeEvent(cleartextPath, ciphertextPath.getRawPath())); - LOG.warn("Did not find valid content inside of {}", ciphertextPath.getRawPath()); + LOG.warn("Ciphertext directory {} has no clear type. Missing id files for dir, symlink or shortened file.", ciphertextPath.getRawPath()); throw new InvalidFileNodeException(cleartextPath.toString(), ciphertextPath.getRawPath().toString()); } } else { diff --git a/src/main/java/org/cryptomator/cryptofs/common/BackupHelper.java b/src/main/java/org/cryptomator/cryptofs/common/BackupHelper.java index 2172d5e1..cd884e7a 100644 --- a/src/main/java/org/cryptomator/cryptofs/common/BackupHelper.java +++ b/src/main/java/org/cryptomator/cryptofs/common/BackupHelper.java @@ -58,7 +58,7 @@ public static Path attemptBackup(Path path) throws IOException { } catch (AccessDeniedException | FileAlreadyExistsException e) { assertSameContent(backupFilePath, path); } catch (IOException e) { - LOG.warn("Failed to backup valid {} file.", fileToBackup); + LOG.warn("Failed to backup {}.", fileToBackup); } return backupFilePath; } @@ -71,7 +71,7 @@ private static void assertSameContent(final Path backupFile, final Path original LOG.warn("Corrupt {} backup for: {}. Please replace it manually or unlock the vault on a writable storage device.", backupFile.getFileName(), backupFile); } } catch (IOException e) { - LOG.warn("Failed to compare valid %s with backup file.".formatted(backupFile), e); + LOG.warn("Failed to compare backup {} to original {} .", backupFile, originalFile, e); } } } diff --git a/src/main/java/org/cryptomator/cryptofs/dir/BrokenDirectoryFilter.java b/src/main/java/org/cryptomator/cryptofs/dir/BrokenDirectoryFilter.java index e3a390ec..68e9f10d 100644 --- a/src/main/java/org/cryptomator/cryptofs/dir/BrokenDirectoryFilter.java +++ b/src/main/java/org/cryptomator/cryptofs/dir/BrokenDirectoryFilter.java @@ -30,11 +30,11 @@ public Stream process(Node node) { try { dirPath = cryptoPathMapper.resolveDirectory(dirFile).path(); } catch (IOException e) { - LOG.warn("Broken directory file: " + dirFile, e); + LOG.warn("Broken directory: Exception reading dir file {}.", dirFile, e); return Stream.empty(); } if (!Files.isDirectory(dirPath)) { - LOG.warn("Broken directory file {}. Directory {} does not exist.", dirFile, dirPath); + LOG.warn("Broken directory: Dir file {} points to non existing content directory {}.", dirFile, dirPath); return Stream.empty(); } } diff --git a/src/main/java/org/cryptomator/cryptofs/dir/C9rConflictResolver.java b/src/main/java/org/cryptomator/cryptofs/dir/C9rConflictResolver.java index 496fe790..d2f214d6 100644 --- a/src/main/java/org/cryptomator/cryptofs/dir/C9rConflictResolver.java +++ b/src/main/java/org/cryptomator/cryptofs/dir/C9rConflictResolver.java @@ -70,7 +70,7 @@ public Stream process(Node node) { return resolveConflict(node, canonicalPath); } catch (IOException e) { eventConsumer.accept(new ConflictResolutionFailedEvent(cleartextPath.resolve(node.cleartextName), node.ciphertextPath, e)); - LOG.error("Failed to resolve conflict for {}", node.ciphertextPath, e); + LOG.warn("Failed to resolve conflict for {}", node.ciphertextPath, e); return Stream.empty(); } } @@ -133,7 +133,7 @@ private Stream renameConflictingFile(Path canonicalPath, Node conflicting) assert alternativeCiphertextName.length() <= maxC9rFileNameLength; if (Files.exists(alternativePath)) { - LOG.warn("Failed finding alternative name for {}. Keeping original name.", conflicting.ciphertextPath); + LOG.warn("Failed finding alternative name for {}: Alternative name {} already exists. Keeping original name.", conflicting.ciphertextPath, alternativePath); return Stream.empty(); } diff --git a/src/main/java/org/cryptomator/cryptofs/health/dirid/DirIdCheck.java b/src/main/java/org/cryptomator/cryptofs/health/dirid/DirIdCheck.java index f553a9f5..9f34d792 100644 --- a/src/main/java/org/cryptomator/cryptofs/health/dirid/DirIdCheck.java +++ b/src/main/java/org/cryptomator/cryptofs/health/dirid/DirIdCheck.java @@ -111,23 +111,23 @@ private FileVisitResult visitDirFile(Path dirFile, BasicFileAttributes attrs) th var parentDirName = dirFile.getParent().getFileName().toString(); if (!(parentDirName.endsWith(Constants.CRYPTOMATOR_FILE_SUFFIX) || parentDirName.endsWith(Constants.DEFLATED_FILE_SUFFIX))) { - LOG.warn("Encountered loose dir.c9r file."); + LOG.debug("Encountered loose dir.c9r file."); resultCollector.accept(new LooseDirFile(dirFile)); return FileVisitResult.CONTINUE; } if (attrs.size() > Constants.MAX_DIR_ID_LENGTH) { - LOG.warn("Encountered dir.c9r file of size {}", attrs.size()); + LOG.debug("Encountered obese dir.c9r file of size {}", attrs.size()); resultCollector.accept(new ObeseDirFile(dirFile, attrs.size())); } else if (attrs.size() == 0) { - LOG.warn("Empty dir.c9r file at {}.", dirFile); + LOG.debug("Encountered empty dir.c9r file at {}.", dirFile); resultCollector.accept(new EmptyDirFile(dirFile)); } else { byte[] bytes = Files.readAllBytes(dirFile); String dirId = new String(bytes, StandardCharsets.UTF_8); if (dirIds.containsKey(dirId)) { var otherFile = dirIds.get(dirId); - LOG.warn("Same directory ID used by {} and {}", dirFile, otherFile); + LOG.debug("Encountered same directory ID twice: Used by {} and {}.", dirFile, otherFile); resultCollector.accept(new DirIdCollision(dirId, dirFile, otherFile)); } else { dirIds.put(dirId, dirFile); diff --git a/src/main/java/org/cryptomator/cryptofs/inuse/RealUseToken.java b/src/main/java/org/cryptomator/cryptofs/inuse/RealUseToken.java index c21aada5..7429d657 100644 --- a/src/main/java/org/cryptomator/cryptofs/inuse/RealUseToken.java +++ b/src/main/java/org/cryptomator/cryptofs/inuse/RealUseToken.java @@ -105,7 +105,7 @@ private void runRefresh(int count) { CONCURRENT_WRITES_SEMAPHORE.release(); } } catch (InterruptedException e) { - LOG.debug("Interrupt during refresh of {}. Closing token.", filePath); + LOG.warn("Interrupt during refresh of {}. Closing token.", filePath); close(); Thread.currentThread().interrupt(); throw new RuntimeException(e); //mark the completion stage as failed diff --git a/src/main/java/org/cryptomator/cryptofs/migration/v7/MigratingVisitor.java b/src/main/java/org/cryptomator/cryptofs/migration/v7/MigratingVisitor.java index 641c3696..8ad689cc 100644 --- a/src/main/java/org/cryptomator/cryptofs/migration/v7/MigratingVisitor.java +++ b/src/main/java/org/cryptomator/cryptofs/migration/v7/MigratingVisitor.java @@ -55,7 +55,7 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOEx Path migratedFile = migration.migrate(); LOG.info("MOVED {} to {}", migration.getOldPath(), migratedFile); } catch (FileAlreadyExistsException e) { - LOG.warn("Failed to migrate " + migration.getOldPath() + " due to FileAlreadyExistsException. This can be caused either by sync conflicts or because this file has already been migrated on a different machine.", e); + LOG.warn("Failed to migrate {} due to FileAlreadyExistsException. This can be caused either by sync conflicts or because this file has already been migrated on a different machine.", migration.getOldPath(), e); } } migrationsInCurrentDir.clear();