Improve logs

- Remove logging of 'SupportedCapabilities is empty...' in Peer
- Add log of number of peesWithNoCapabilitiesSet at persistedPeerList
This commit is contained in:
Manfred Karrer 2018-10-04 14:54:38 -05:00
parent 281e156449
commit 3d8d8cc760
No known key found for this signature in database
GPG key ID: 401250966A6B2C46
2 changed files with 13 additions and 5 deletions

View file

@ -178,8 +178,19 @@ public class PeerManager implements ConnectionListener, PersistedDataHost {
@Override
public void readPersisted() {
PeerList persistedPeerList = storage.initAndGetPersistedWithFileName("PeerList", 1000);
if (persistedPeerList != null)
if (persistedPeerList != null) {
long peesWithNoCapabilitiesSet = persistedPeerList.getList().stream()
.filter(e -> e.getSupportedCapabilities().isEmpty())
.mapToInt(e -> 1)
.count();
if (peesWithNoCapabilitiesSet > 100) {
log.warn("peesWithNoCapabilitiesSet={}, persistedPeerList.size()={}", peesWithNoCapabilitiesSet, persistedPeerList.size());
} else {
log.info("peesWithNoCapabilitiesSet={}, persistedPeerList.size()={}", peesWithNoCapabilitiesSet, persistedPeerList.size());
}
this.persistedPeers.addAll(persistedPeerList.getList());
}
}
public int getMaxConnections() {
@ -648,7 +659,7 @@ public class PeerManager implements ConnectionListener, PersistedDataHost {
.filter(peer -> peer.getDate().getTime() > maxAge)
.collect(Collectors.toSet());
if (oldNumLatestLivePeers != latestLivePeers.size())
log.info("Num of latestLivePeers={}, latestLivePeers={}", latestLivePeers.size(), latestLivePeers);
log.info("Num of latestLivePeers={}", latestLivePeers.size());
return latestLivePeers;
}

View file

@ -64,9 +64,6 @@ public final class Peer implements NetworkPayload, PersistablePayload, Supported
this.nodeAddress = nodeAddress;
this.date = date;
this.supportedCapabilities = supportedCapabilities;
if (supportedCapabilities.isEmpty())
log.warn("SupportedCapabilities is empty. nodeAddress={}", nodeAddress);
}
@Override