Change log level to debug for non-essential logs

Set loge level for org.berndpruenster.netlayer.tor.Tor to WARN (we get repeated logs about HS announced to network from netlayer - would be better to change in netlayer).
Make data request/response logs more visible with line breaks
This commit is contained in:
djing chan 2023-11-19 14:40:24 +07:00
parent 65a020ad7f
commit 8ee67e555d
No known key found for this signature in database
GPG Key ID: E87DCA978E5DED30
5 changed files with 14 additions and 12 deletions

View File

@ -2,10 +2,12 @@
<configuration>
<appender name="CONSOLE_APPENDER" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%highlight(%d{MMM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{30}: %msg %xEx%n)</pattern>
<pattern>%highlight(%d{MMM-dd HH:mm:ss.SSS} [%thread] %-5level%logger{30}: %msg %xEx%n)</pattern>
</encoder>
</appender>
<!-- <logger name="org.bitcoinj" level="WARN"/>-->
<logger name="org.berndpruenster.netlayer.tor.Tor" level="WARN"/>
<root level="TRACE">
<appender-ref ref="CONSOLE_APPENDER"/>
</root>

View File

@ -142,7 +142,7 @@ class RequestDataHandler implements MessageListener {
}
getDataRequestType = getDataRequest.getClass().getSimpleName();
log.info("We send a {} to peer {}. ", getDataRequestType, nodeAddress);
log.info("\n\n>> We send a {} to peer {}\n", getDataRequestType, nodeAddress);
networkNode.addMessageListener(this);
SettableFuture<Connection> future = networkNode.sendMessage(nodeAddress, getDataRequest);
//noinspection UnstableApiUsage
@ -242,7 +242,7 @@ class RequestDataHandler implements MessageListener {
StringBuilder sb = new StringBuilder();
String sep = System.lineSeparator();
sb.append(sep).append("#################################################################").append(sep);
sb.append("Connected to node: ").append(peersNodeAddress.getFullAddress()).append(sep);
sb.append("Data provided by node: ").append(peersNodeAddress.getFullAddress()).append(sep);
int items = dataSet.size() + persistableNetworkPayloadSet.size();
sb.append("Received ").append(items).append(" instances from a ")
.append(getDataRequestType).append(sep);
@ -252,7 +252,7 @@ class RequestDataHandler implements MessageListener {
.append(" / ")
.append(Utilities.readableFileSize(value.second.get()))
.append(sep));
sb.append("#################################################################");
sb.append("#################################################################\n");
log.info(sb.toString());
}

View File

@ -126,7 +126,7 @@ public final class GetDataResponse extends NetworkEnvelope implements SupportedC
NetworkProtoResolver resolver,
int messageVersion) {
boolean wasTruncated = proto.getWasTruncated();
log.info("Received a GetDataResponse with {} {}",
log.info("\n\n<< Received a GetDataResponse with {} {}\n",
Utilities.readableFileSize(proto.getSerializedSize()),
wasTruncated ? " (was truncated)" : "");
Set<ProtectedStorageEntry> dataSet = proto.getDataSetList().stream()

View File

@ -145,7 +145,7 @@ public abstract class HistoricalDataStoreService<T extends PersistableNetworkPay
@Override
protected void readFromResources(String postFix, Runnable completeHandler) {
readStore(persisted -> {
log.info("We have created the {} store for the live data and filled it with {} entries from the persisted data.",
log.debug("We have created the {} store for the live data and filled it with {} entries from the persisted data.",
getFileName(), getMapOfLiveData().size());
// Now we add our historical data stores.
@ -185,7 +185,7 @@ public abstract class HistoricalDataStoreService<T extends PersistableNetworkPay
persistenceManager.readPersisted(fileName, persisted -> {
storesByVersion.put(version, persisted);
allHistoricalPayloads.putAll(persisted.getMap());
log.info("We have read from {} {} historical items.", fileName, persisted.getMap().size());
log.debug("We have read from {} {} historical items.", fileName, persisted.getMap().size());
pruneStore(persisted, version);
completeHandler.run();
},
@ -199,11 +199,11 @@ public abstract class HistoricalDataStoreService<T extends PersistableNetworkPay
mapOfLiveData.keySet().removeAll(historicalStore.getMap().keySet());
int postLive = mapOfLiveData.size();
if (preLive > postLive) {
log.info("We pruned data from our live data store which are already contained in the historical data store with version {}. " +
log.debug("We pruned data from our live data store which are already contained in the historical data store with version {}. " +
"The live map had {} entries before pruning and has {} entries afterwards.",
version, preLive, postLive);
} else {
log.info("No pruning from historical data store with version {} was applied", version);
log.debug("No pruning from historical data store with version {} was applied", version);
}
requestPersistence();
}

View File

@ -113,18 +113,18 @@ public abstract class StoreService<T extends PersistableEnvelope> {
File destinationFile = new File(Paths.get(absolutePathOfStorageDir, fileName).toString());
if (!destinationFile.exists()) {
try {
log.info("We copy resource to file: resourceFileName={}, destinationFile={}", resourceFileName, destinationFile);
log.debug("We copy resource to file: resourceFileName={}, destinationFile={}", resourceFileName, destinationFile);
FileUtil.resourceToFile(resourceFileName, destinationFile);
return true;
} catch (ResourceNotFoundException e) {
log.info("Could not find resourceFile " + resourceFileName + ". That is expected if none is provided yet.");
log.debug("Could not find resourceFile " + resourceFileName + ". That is expected if none is provided yet.");
} catch (Throwable e) {
log.error("Could not copy resourceFile " + resourceFileName + " to " +
destinationFile.getAbsolutePath() + ".\n" + e.getMessage());
e.printStackTrace();
}
} else {
log.info("No resource file was copied. {} exists already.", fileName);
log.debug("No resource file was copied. {} exists already.", fileName);
}
return false;
}