forked from Qortal/qortal
Improved logging
This commit is contained in:
parent
8fac0a02e5
commit
be0426d9a2
@ -152,6 +152,7 @@ public class ArbitraryDataBuilder {
|
||||
|
||||
// Loop from the second path onwards
|
||||
for (int i=1; i<paths.size(); i++) {
|
||||
LOGGER.info(String.format("[%s][%s] Applying layer %d...", this.service, this.name, i));
|
||||
Path pathAfter = this.paths.get(i);
|
||||
ArbitraryDataCombiner combiner = new ArbitraryDataCombiner(pathBefore, pathAfter);
|
||||
combiner.combine();
|
||||
|
@ -7,6 +7,7 @@ import org.qortal.utils.FilesystemUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.DirectoryNotEmptyException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
@ -55,6 +56,8 @@ public class ArbitraryDataCombiner {
|
||||
if (FilesystemUtils.pathInsideDataOrTempPath(parentDirectory)) {
|
||||
try {
|
||||
Files.deleteIfExists(parentDirectory);
|
||||
} catch (DirectoryNotEmptyException e) {
|
||||
// No need to log anything
|
||||
} catch (IOException e) {
|
||||
// This will eventually be cleaned up by a maintenance process, so log the error and continue
|
||||
LOGGER.info("Unable to cleanup parent directory {}", parentDirectory.toString());
|
||||
|
@ -219,7 +219,8 @@ public class ArbitraryDataReader {
|
||||
if (!arbitraryDataFile.exists()) {
|
||||
if (!arbitraryDataFile.allChunksExist(chunkHashes)) {
|
||||
// TODO: fetch them?
|
||||
throw new IllegalStateException(String.format("Missing chunks for file {}", arbitraryDataFile));
|
||||
LOGGER.info(String.format("Missing chunks for file {}", arbitraryDataFile));
|
||||
throw new IllegalStateException(String.format("Missing chunks for file %s", arbitraryDataFile));
|
||||
}
|
||||
// We have all the chunks but not the complete file, so join them
|
||||
arbitraryDataFile.addChunkHashes(chunkHashes);
|
||||
@ -317,6 +318,8 @@ public class ArbitraryDataReader {
|
||||
Files.deleteIfExists(parentDirectory);
|
||||
}
|
||||
|
||||
} catch (DirectoryNotEmptyException e) {
|
||||
// No need to log anything
|
||||
} catch (IOException e) {
|
||||
// This will eventually be cleaned up by a maintenance process, so log the error and continue
|
||||
LOGGER.info("Unable to cleanup directories: {}", e.getMessage());
|
||||
|
Loading…
Reference in New Issue
Block a user