some logging tweaks

This commit is contained in:
2024-07-27 14:48:04 +02:00
parent 8384cc9efc
commit 2d8744b426
8 changed files with 19 additions and 17 deletions

View File

@@ -35,9 +35,12 @@ jobs:
distribution: "zulu"
cache: maven
- name: Build and test with Maven
- name: Test with Maven
run: cd dhfs-parent && mvn --batch-mode --update-snapshots package verify
- name: Build with Maven
run: cd dhfs-parent && mvn --batch-mode --update-snapshots package -Dquarkus.log.category.\"com.usatiuk.dhfs\".min-level=DEBUG
- uses: actions/upload-artifact@v3
with:
name: DHFS Server Package

View File

@@ -149,7 +149,7 @@ public class DhfsFileServiceImpl implements DhfsFileService {
String fname = Path.of(name).getFileName().toString();
var fuuid = UUID.randomUUID();
Log.trace("Creating file " + fuuid);
Log.debug("Creating file " + fuuid);
File f = new File(fuuid, mode, UUID.fromString(parent.getName()), false);
if (!parent.runWriteLocked(JObject.ResolutionStrategy.REMOTE, (m, d, bump, invalidate) -> {
@@ -181,7 +181,7 @@ public class DhfsFileServiceImpl implements DhfsFileService {
String dname = Path.of(name).getFileName().toString();
var duuid = UUID.randomUUID();
Log.trace("Creating dir " + duuid);
Log.debug("Creating dir " + duuid);
Directory ndir = new Directory(duuid, mode); //FIXME:
if (!found.runWriteLocked(JObject.ResolutionStrategy.REMOTE, (m, d, bump, invalidate) -> {
@@ -799,7 +799,7 @@ public class DhfsFileServiceImpl implements DhfsFileService {
String fname = Path.of(newpath).getFileName().toString();
var fuuid = UUID.randomUUID();
Log.trace("Creating file " + fuuid);
Log.debug("Creating file " + fuuid);
File f = new File(fuuid, 0, UUID.fromString(parent.getName()), true);
ChunkData newChunkData = createChunk(UnsafeByteOperations.unsafeWrap(oldpath.getBytes(StandardCharsets.UTF_8)));

View File

@@ -96,7 +96,7 @@ public class JObjectRefProcessor {
}
if (ok != missing.size()) {
Log.trace("Delaying deletion check of " + obj.getName());
Log.debug("Delaying deletion check of " + obj.getName());
delay = true;
}
@@ -167,7 +167,7 @@ public class JObjectRefProcessor {
got.tryResolve(JObject.ResolutionStrategy.LOCAL_ONLY);
Log.trace("Deleting " + m.getName());
Log.debug("Deleting " + m.getName());
m.markDeleted();
Collection<String> extracted = null;

View File

@@ -175,7 +175,7 @@ public class JObjectResolver {
public void removeLocal(JObject<?> jObject, String name) {
jObject.assertRWLock();
try {
Log.trace("Invalidating " + name);
Log.debug("Invalidating " + name);
jObject.getMeta().getHaveLocalCopy().set(false);
jObjectWriteback.remove(jObject);
objectPersistentStore.deleteObjectData(name);

View File

@@ -161,7 +161,7 @@ public class JObjectWriteback {
if (!m.isDeletionCandidate())
throw new IllegalStateException("Object deleted but not deletable! " + m.getName());
// FIXME: assert Rw lock here?
Log.trace("Deleting from persistent storage " + m.getName());
Log.debug("Deleting from persistent storage " + m.getName());
objectPersistentStore.deleteObject(m.getName());
return;
}

View File

@@ -63,7 +63,7 @@ public class RemoteHostManager {
.<Callable<Void>>map(host -> () -> {
try {
if (isReachable(host))
Log.trace("Heartbeat: " + host);
Log.debug("Heartbeat: " + host);
else
Log.info("Trying to connect to " + host);
if (pingCheck(host))
@@ -206,7 +206,7 @@ public class RemoteHostManager {
var prev = _seenHostsButNotAdded.put(host, state);
// Needed for tests
if (prev == null)
Log.trace("Ignoring new address from unknown host " + ": addr=" + addr + " port=" + port);
Log.debug("Ignoring new address from unknown host " + ": addr=" + addr + " port=" + port);
return;
} else {
_seenHostsButNotAdded.remove(host);

View File

@@ -37,7 +37,7 @@ public class RpcClientFactory {
return withObjSyncClient(target, fn);
} catch (StatusRuntimeException e) {
if (e.getStatus().getCode().equals(Status.UNAVAILABLE.getCode()))
Log.trace("Host " + target + " is unreachable: " + e.getMessage());
Log.debug("Host " + target + " is unreachable: " + e.getMessage());
else
Log.warn("When calling " + target + " " + e.getMessage());
} catch (Exception e) {

View File

@@ -107,9 +107,9 @@ public class FileObjectPersistentStore implements ObjectPersistentStore {
}
private <T extends Message> T readObjectImpl(T defaultInstance, Path path) {
try (var fsb = new FileInputStream(path.toFile());
var fs = new BufferedInputStream(fsb, 131072)) {
return (T) defaultInstance.getParserForType().parseFrom(fs);
try (var fsb = new FileInputStream(path.toFile())) {
var file = fsb.readAllBytes();
return (T) defaultInstance.getParserForType().parseFrom(file);
} catch (FileNotFoundException | NoSuchFileException fx) {
throw new StatusRuntimeExceptionNoStacktrace(Status.NOT_FOUND);
} catch (IOException e) {
@@ -132,9 +132,8 @@ public class FileObjectPersistentStore implements ObjectPersistentStore {
private void writeObjectImpl(Path path, Message data) {
try {
try (var fsb = new FileOutputStream(path.toFile(), false);
var fs = new BufferedOutputStream(fsb, 131072)) {
data.writeTo(fs);
try (var fsb = new FileOutputStream(path.toFile(), false)) {
fsb.write(data.toByteArray());
}
} catch (IOException e) {
Log.error("Error writing file " + path, e);