NC-1675 Ensure that default logging is appropriate (#88)

* Take peer status messages down from info to debug
* Take P2P messages down from debug to trace
Danno Ferrin 6 years ago committed by GitHub
parent 9d5f4d2b87
commit ad82ca265a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/core/TransactionPool.java
  2. 10
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/EthProtocolManager.java
  3. 4
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/Downloader.java
  4. 2
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/tasks/AbstractGetHeadersFromPeerTask.java
  5. 2
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/tasks/CompleteBlocksTask.java
  6. 4
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/tasks/DownloadHeaderSequenceTask.java
  7. 2
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/tasks/GetBodiesFromPeerTask.java
  8. 2
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/tasks/GetHeadersFromPeerByHashTask.java
  9. 14
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/tasks/PipelinedImportChainSegmentTask.java
  10. 2
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/PeerDiscoveryAgent.java
  11. 2
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PeerDiscoveryController.java
  12. 2
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/netty/ApiHandler.java
  13. 2
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/netty/DeFramer.java
  14. 10
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/netty/NettyP2PNetwork.java
  15. 6
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/netty/NettyPeerConnection.java

@ -85,7 +85,7 @@ public class TransactionPool implements BlockAddedObserver {
addedTransactions.add(transaction);
}
} else {
LOG.debug(
LOG.trace(
"Validation failed ({}) for transaction {}. Discarding.",
validationResult.getInvalidReason(),
transaction);

@ -188,7 +188,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver {
blockchain.getChainHeadHash(),
genesisHash);
try {
LOG.info("Sending status message to {}.", peer);
LOG.debug("Sending status message to {}.", peer);
peer.send(status);
peer.registerStatusSent();
} catch (final PeerNotConnected peerNotConnected) {
@ -203,13 +203,13 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver {
final boolean initiatedByPeer) {
ethPeers.registerDisconnect(connection);
if (initiatedByPeer) {
LOG.info(
LOG.debug(
"Peer requested to be disconnected ({}), {} peers left: {}",
reason,
ethPeers.peerCount(),
ethPeers);
} else {
LOG.info(
LOG.debug(
"Disconnecting from peer ({}), {} peers left: {}",
reason,
ethPeers.peerCount(),
@ -226,7 +226,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver {
final StatusMessage status = StatusMessage.readFrom(data);
try {
if (status.networkId() != networkId) {
LOG.info("Disconnecting from peer with mismatched network id: {}", status.networkId());
LOG.debug("Disconnecting from peer with mismatched network id: {}", status.networkId());
peer.disconnect(DisconnectReason.SUBPROTOCOL_TRIGGERED);
} else if (!status.genesisHash().equals(genesisHash)) {
LOG.warn(
@ -235,7 +235,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver {
status.genesisHash());
peer.disconnect(DisconnectReason.SUBPROTOCOL_TRIGGERED);
} else {
LOG.info("Received status message from {}: {}", peer, status);
LOG.debug("Received status message from {}: {}", peer, status);
peer.registerStatusReceived(status.bestHash(), status.totalDifficulty());
}
} catch (final RLPException e) {

@ -300,7 +300,7 @@ public class Downloader<C> {
} else {
checkpointTimeouts = 0;
checkpointHeaders.addAll(headers);
LOG.info("Tracking {} checkpoint headers", checkpointHeaders.size());
LOG.debug("Tracking {} checkpoint headers", checkpointHeaders.size());
}
return r;
});
@ -310,7 +310,7 @@ public class Downloader<C> {
final SyncTarget syncTarget) {
final BlockHeader lastHeader =
checkpointHeaders.size() > 0 ? checkpointHeaders.getLast() : syncTarget.commonAncestor();
LOG.info("Requesting checkpoint headers from {}", lastHeader.getNumber());
LOG.debug("Requesting checkpoint headers from {}", lastHeader.getNumber());
return GetHeadersFromPeerByHashTask.startingAtHash(
protocolSchedule,
ethContext,

@ -102,7 +102,7 @@ public abstract class AbstractGetHeadersFromPeerTask
}
}
LOG.info("Received {} of {} headers requested from peer.", headersList.size(), count);
LOG.debug("Received {} of {} headers requested from peer.", headersList.size(), count);
return Optional.of(headersList);
} finally {
headersMessage.release();

@ -104,7 +104,7 @@ public class CompleteBlocksTask<C> extends AbstractRetryingPeerTask<List<Block>>
private CompletableFuture<PeerTaskResult<List<Block>>> requestBodies() {
final List<BlockHeader> incompleteHeaders = incompleteHeaders();
LOG.info(
LOG.debug(
"Requesting bodies to complete {} blocks, starting with {}.",
incompleteHeaders.size(),
incompleteHeaders.get(0).getNumber());

@ -107,7 +107,7 @@ public class DownloadHeaderSequenceTask<C> extends AbstractRetryingPeerTask<List
@Override
protected CompletableFuture<?> executePeerTask() {
LOG.info(
LOG.debug(
"Downloading headers from {} to {}.", startingBlockNumber, referenceHeader.getNumber() - 1);
final CompletableFuture<List<BlockHeader>> task =
downloadHeaders().thenCompose(this::processHeaders);
@ -115,7 +115,7 @@ public class DownloadHeaderSequenceTask<C> extends AbstractRetryingPeerTask<List
(r, t) -> {
// We're done if we've filled all requested headers
if (r != null && r.size() == segmentLength) {
LOG.info(
LOG.debug(
"Finished downloading headers from {} to {}.",
startingBlockNumber,
referenceHeader.getNumber() - 1);

@ -84,7 +84,7 @@ public class GetBodiesFromPeerTask<C> extends AbstractPeerRequestTask<List<Block
protected ResponseStream sendRequest(final EthPeer peer) throws PeerNotConnected {
final List<Hash> blockHashes =
headers.stream().map(BlockHeader::getHash).collect(Collectors.toList());
LOG.info("Requesting {} bodies from peer {}.", blockHashes.size(), peer);
LOG.debug("Requesting {} bodies from peer {}.", blockHashes.size(), peer);
return peer.getBodies(blockHashes);
}

@ -84,7 +84,7 @@ public class GetHeadersFromPeerByHashTask extends AbstractGetHeadersFromPeerTask
@Override
protected ResponseStream sendRequest(final EthPeer peer) throws PeerNotConnected {
LOG.info("Requesting {} headers from peer {}.", count, peer);
LOG.debug("Requesting {} headers from peer {}.", count, peer);
return peer.getHeadersByHash(referenceHash, count, reverse, skip);
}

@ -103,7 +103,7 @@ public class PipelinedImportChainSegmentTask<C> extends AbstractEthTask<List<Blo
@Override
protected void executeTask() {
LOG.info(
LOG.debug(
"Importing chain segment from {} to {}.",
firstHeader().getNumber(),
lastHeader().getNumber());
@ -144,7 +144,7 @@ public class PipelinedImportChainSegmentTask<C> extends AbstractEthTask<List<Blo
public void completeChunkPipelineAndMaybeLaunchNextOne(
final List<Block> blocks, final Throwable throwable) {
if (throwable != null) {
LOG.info(
LOG.warn(
"Import of chain segment ({} to {}) failed: {}.",
firstHeader().getNumber(),
lastHeader().getNumber());
@ -155,7 +155,7 @@ public class PipelinedImportChainSegmentTask<C> extends AbstractEthTask<List<Blo
final BlockHeader firstHeader = blocks.get(0).getHeader();
final BlockHeader lastHeader = blocks.get(blocks.size() - 1).getHeader();
chunksCompleted++;
LOG.info(
LOG.debug(
"Import chain segment from {} to {} succeeded (chunk {}/{}).",
firstHeader.getNumber(),
lastHeader.getNumber(),
@ -182,7 +182,7 @@ public class PipelinedImportChainSegmentTask<C> extends AbstractEthTask<List<Blo
private CompletableFuture<List<BlockHeader>> downloadNextHeaders(
final BlockHeader firstChunkHeader, final BlockHeader lastChunkHeader) {
// Download the headers we're missing (between first and last)
LOG.info(
LOG.debug(
"Downloading headers {} to {}",
firstChunkHeader.getNumber() + 1,
lastChunkHeader.getNumber());
@ -233,7 +233,7 @@ public class PipelinedImportChainSegmentTask<C> extends AbstractEthTask<List<Blo
}
private CompletableFuture<List<Block>> downloadBlocks(final List<BlockHeader> headers) {
LOG.info(
LOG.debug(
"Downloading bodies {} to {}",
headers.get(0).getNumber(),
headers.get(headers.size() - 1).getNumber());
@ -243,7 +243,7 @@ public class PipelinedImportChainSegmentTask<C> extends AbstractEthTask<List<Blo
}
private CompletableFuture<List<Block>> validateAndImportBlocks(final List<Block> blocks) {
LOG.info(
LOG.debug(
"Validating and importing {} to {}",
blocks.get(0).getHeader().getNumber(),
blocks.get(blocks.size() - 1).getHeader().getNumber());
@ -254,7 +254,7 @@ public class PipelinedImportChainSegmentTask<C> extends AbstractEthTask<List<Blo
}
private CompletableFuture<List<Block>> extractTransactionSenders(final List<Block> blocks) {
LOG.info(
LOG.debug(
"Extracting sender {} to {}",
blocks.get(0).getHeader().getNumber(),
blocks.get(blocks.size() - 1).getHeader().getNumber());

@ -280,7 +280,7 @@ public class PeerDiscoveryAgent implements DisconnectCallback {
*/
public Packet sendPacket(final DiscoveryPeer peer, final PacketType type, final PacketData data) {
final Packet packet = Packet.create(type, data, keyPair);
LOG.debug(
LOG.trace(
">>> Sending {} discovery packet to {} ({}): {}",
type,
peer.getEndpoint(),

@ -183,7 +183,7 @@ public class PeerDiscoveryController {
* @param sender The sender.
*/
public void onMessage(final Packet packet, final DiscoveryPeer sender) {
LOG.debug(
LOG.trace(
"<<< Received {} discovery packet from {} ({}): {}",
packet.getType(),
sender.getEndpoint(),

@ -77,7 +77,7 @@ final class ApiHandler extends SimpleChannelInboundHandler<MessageData> {
DisconnectReason reason = null;
try {
reason = disconnect.getReason();
LOG.info(
LOG.debug(
"Received Wire DISCONNECT ({}) from peer: {}",
reason.name(),
connection.getPeer().getClientId());

@ -81,7 +81,7 @@ final class DeFramer extends ByteToMessageDecoder {
final PeerConnection connection =
new NettyPeerConnection(ctx, peerInfo, capabilityMultiplexer, callbacks);
if (capabilityMultiplexer.getAgreedCapabilities().size() == 0) {
LOG.info(
LOG.debug(
"Disconnecting from {} because no capabilities are shared.", peerInfo.getClientId());
connectFuture.completeExceptionally(
new IncompatiblePeerException("No shared capabilities"));

@ -221,7 +221,7 @@ public final class NettyP2PNetwork implements P2PNetwork {
connection -> {
// Reject incoming connections if we've reached our limit
if (connections.size() >= maxPeers) {
LOG.info(
LOG.debug(
"Disconnecting incoming connection because connection limit of {} has been reached: {}",
maxPeers,
connection.getPeer().getNodeId());
@ -235,7 +235,7 @@ public final class NettyP2PNetwork implements P2PNetwork {
}
onConnectionEstablished(connection);
LOG.info(
LOG.debug(
"Successfully accepted connection from {}", connection.getPeer().getNodeId());
logConnections();
});
@ -302,9 +302,9 @@ public final class NettyP2PNetwork implements P2PNetwork {
pendingConnections.decrementAndGet();
if (t == null) {
onConnectionEstablished(connection);
LOG.info("Connection established to peer: {}", peer.getId());
LOG.debug("Connection established to peer: {}", peer.getId());
} else {
LOG.warn("Failed to connect to peer {}: {}", peer.getId(), t);
LOG.debug("Failed to connect to peer {}: {}", peer.getId(), t);
}
logConnections();
});
@ -312,7 +312,7 @@ public final class NettyP2PNetwork implements P2PNetwork {
}
private void logConnections() {
LOG.info(
LOG.debug(
"Connections: {} pending, {} active connections.",
pendingConnections.get(),
connections.size());

@ -86,7 +86,7 @@ final class NettyPeerConnection implements PeerConnection {
}
}
LOG.debug("Writing {} to {} via protocol {}", message, peerInfo, capability);
LOG.trace("Writing {} to {} via protocol {}", message, peerInfo, capability);
ctx.channel().writeAndFlush(new OutboundMessage(capability, message));
}
@ -108,7 +108,7 @@ final class NettyPeerConnection implements PeerConnection {
@Override
public void terminateConnection(final DisconnectReason reason, final boolean peerInitiated) {
if (disconnectDispatched.compareAndSet(false, true)) {
LOG.info("Disconnected ({}) from {}", reason, peerInfo);
LOG.debug("Disconnected ({}) from {}", reason, peerInfo);
callbacks.invokeDisconnect(this, reason, peerInitiated);
disconnected.set(true);
}
@ -120,7 +120,7 @@ final class NettyPeerConnection implements PeerConnection {
@Override
public void disconnect(final DisconnectReason reason) {
if (disconnectDispatched.compareAndSet(false, true)) {
LOG.info("Disconnecting ({}) from {}", reason, peerInfo);
LOG.debug("Disconnecting ({}) from {}", reason, peerInfo);
callbacks.invokeDisconnect(this, reason, false);
try {
send(null, DisconnectMessage.create(reason));

Loading…
Cancel
Save