Improve loggings

This commit is contained in:
Manfred Karrer 2016-02-01 19:26:21 +01:00
parent 406bcd31ef
commit 6e1f92a05b
5 changed files with 7 additions and 7 deletions

View File

@ -485,14 +485,14 @@ public class Connection implements MessageListener {
shutDownReason = ConnectionListener.Reason.RESET;
} else if (e instanceof SocketTimeoutException || e instanceof TimeoutException) {
shutDownReason = ConnectionListener.Reason.TIMEOUT;
log.debug("TimeoutException at socket " + socket.toString() + " on connection={}" + this);
log.debug("TimeoutException at socket " + socket.toString() + "\n\tconnection={}" + this);
} else if (e instanceof EOFException) {
shutDownReason = ConnectionListener.Reason.PEER_DISCONNECTED;
} else if (e instanceof NoClassDefFoundError || e instanceof ClassNotFoundException) {
shutDownReason = ConnectionListener.Reason.INCOMPATIBLE_DATA;
} else {
shutDownReason = ConnectionListener.Reason.UNKNOWN;
log.warn("Unknown reason for exception at socket {} on connection={}\n\tException=",
log.warn("Unknown reason for exception at socket {}\n\tconnection={}\n\tException=",
socket.toString(), this, e.getMessage());
e.printStackTrace();
}

View File

@ -109,7 +109,7 @@ public class PeerExchangeManager implements MessageListener, ConnectionListener
new PeerExchangeHandshake.Listener() {
@Override
public void onComplete() {
log.trace("PeerExchangeHandshake of inbound connection complete. Connection={}", connection);
log.trace("PeerExchangeHandshake of inbound connection complete.\n\tConnection={}", connection);
}
@Override

View File

@ -209,7 +209,7 @@ public class PeerManager implements ConnectionListener, MessageListener {
candidates.sort((o1, o2) -> o1.getLastActivityDate().compareTo(o2.getLastActivityDate()));
log.info("Candidates.size() for shut down=" + candidates.size());
Connection connection = candidates.remove(0);
log.info("We are going to shut down the oldest connection. connection=" + connection.toString());
log.info("We are going to shut down the oldest connection.\n\tconnection=" + connection.toString());
connection.shutDown(() -> checkMaxConnections(limit));
return true;
} else {
@ -251,7 +251,7 @@ public class PeerManager implements ConnectionListener, MessageListener {
candidates.sort((o1, o2) -> o1.getLastActivityDate().compareTo(o2.getLastActivityDate()));
log.info("Number of connections exceeding MAX_CONNECTIONS_EXTENDED_1. Current size=" + candidates.size());
Connection connection = candidates.remove(0);
log.info("We are going to shut down the oldest connection. connection=" + connection.toString());
log.info("We are going to shut down the oldest connection.\n\tconnection=" + connection.toString());
connection.shutDown(this::removeSuperfluousSeedNodes);
}
}

View File

@ -119,7 +119,7 @@ public class RequestDataManager implements MessageListener {
new RequestDataHandshake.Listener() {
@Override
public void onComplete() {
log.trace("requestDataHandshake of inbound connection complete. Connection={}",
log.trace("requestDataHandshake of inbound connection complete.\n\tConnection={}",
connection);
}

View File

@ -104,7 +104,7 @@ public class P2PDataStorage implements MessageListener {
public void onMessage(Message message, Connection connection) {
if (message instanceof DataBroadcastMessage) {
Log.traceCall(message.toString() + "\n\tconnection=" + connection);
log.trace("DataBroadcastMessage received " + message + " on connection " + connection);
log.trace("DataBroadcastMessage received " + message + "\n\tconnection " + connection);
connection.getPeersNodeAddressOptional().ifPresent(peersNodeAddress -> {
if (message instanceof AddDataMessage) {
add(((AddDataMessage) message).data, peersNodeAddress);