Improve logging

This commit is contained in:
Manfred Karrer 2016-07-31 22:17:49 +02:00
parent 814bf8d065
commit f73c05420a

View File

@ -162,7 +162,9 @@ public class PeerManager implements ConnectionListener {
final boolean seedNode = isSeedNode(connection);
final Optional<NodeAddress> addressOptional = connection.getPeersNodeAddressOptional();
log.info("onConnection: peer = {}{}", (addressOptional.isPresent() ? addressOptional.get().hostName : "not known yet"), seedNode ? " (SeedNode)" : "");
log.info("onConnection: peer = {}{}",
(addressOptional.isPresent() ? addressOptional.get().hostName : "not known yet (connection id=" + connection.getUid() + ")"),
seedNode ? " (SeedNode)" : "");
if (seedNode)
connection.setPeerType(Connection.PeerType.SEED_NODE);
@ -184,7 +186,10 @@ public class PeerManager implements ConnectionListener {
" / closeConnectionReason: " + closeConnectionReason);
final Optional<NodeAddress> addressOptional = connection.getPeersNodeAddressOptional();
log.info("onDisconnect: peer = {}{}", (addressOptional.isPresent() ? addressOptional.get().hostName : "not known yet"), isSeedNode(connection) ? " (SeedNode)" : "");
log.info("onDisconnect: peer = {}{} / closeConnectionReason: {}",
(addressOptional.isPresent() ? addressOptional.get().hostName : "not known yet (connection id=" + connection.getUid() + ")"),
isSeedNode(connection) ? " (SeedNode)" : "",
closeConnectionReason);
handleConnectionFault(connection);