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); addedTransactions.add(transaction);
} }
} else { } else {
LOG.debug( LOG.trace(
"Validation failed ({}) for transaction {}. Discarding.", "Validation failed ({}) for transaction {}. Discarding.",
validationResult.getInvalidReason(), validationResult.getInvalidReason(),
transaction); transaction);

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

@ -300,7 +300,7 @@ public class Downloader<C> {
} else { } else {
checkpointTimeouts = 0; checkpointTimeouts = 0;
checkpointHeaders.addAll(headers); checkpointHeaders.addAll(headers);
LOG.info("Tracking {} checkpoint headers", checkpointHeaders.size()); LOG.debug("Tracking {} checkpoint headers", checkpointHeaders.size());
} }
return r; return r;
}); });
@ -310,7 +310,7 @@ public class Downloader<C> {
final SyncTarget syncTarget) { final SyncTarget syncTarget) {
final BlockHeader lastHeader = final BlockHeader lastHeader =
checkpointHeaders.size() > 0 ? checkpointHeaders.getLast() : syncTarget.commonAncestor(); 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( return GetHeadersFromPeerByHashTask.startingAtHash(
protocolSchedule, protocolSchedule,
ethContext, 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); return Optional.of(headersList);
} finally { } finally {
headersMessage.release(); headersMessage.release();

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

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

@ -84,7 +84,7 @@ public class GetBodiesFromPeerTask<C> extends AbstractPeerRequestTask<List<Block
protected ResponseStream sendRequest(final EthPeer peer) throws PeerNotConnected { protected ResponseStream sendRequest(final EthPeer peer) throws PeerNotConnected {
final List<Hash> blockHashes = final List<Hash> blockHashes =
headers.stream().map(BlockHeader::getHash).collect(Collectors.toList()); 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); return peer.getBodies(blockHashes);
} }

@ -84,7 +84,7 @@ public class GetHeadersFromPeerByHashTask extends AbstractGetHeadersFromPeerTask
@Override @Override
protected ResponseStream sendRequest(final EthPeer peer) throws PeerNotConnected { 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); return peer.getHeadersByHash(referenceHash, count, reverse, skip);
} }

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

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

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

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

@ -221,7 +221,7 @@ public final class NettyP2PNetwork implements P2PNetwork {
connection -> { connection -> {
// Reject incoming connections if we've reached our limit // Reject incoming connections if we've reached our limit
if (connections.size() >= maxPeers) { if (connections.size() >= maxPeers) {
LOG.info( LOG.debug(
"Disconnecting incoming connection because connection limit of {} has been reached: {}", "Disconnecting incoming connection because connection limit of {} has been reached: {}",
maxPeers, maxPeers,
connection.getPeer().getNodeId()); connection.getPeer().getNodeId());
@ -235,7 +235,7 @@ public final class NettyP2PNetwork implements P2PNetwork {
} }
onConnectionEstablished(connection); onConnectionEstablished(connection);
LOG.info( LOG.debug(
"Successfully accepted connection from {}", connection.getPeer().getNodeId()); "Successfully accepted connection from {}", connection.getPeer().getNodeId());
logConnections(); logConnections();
}); });
@ -302,9 +302,9 @@ public final class NettyP2PNetwork implements P2PNetwork {
pendingConnections.decrementAndGet(); pendingConnections.decrementAndGet();
if (t == null) { if (t == null) {
onConnectionEstablished(connection); onConnectionEstablished(connection);
LOG.info("Connection established to peer: {}", peer.getId()); LOG.debug("Connection established to peer: {}", peer.getId());
} else { } else {
LOG.warn("Failed to connect to peer {}: {}", peer.getId(), t); LOG.debug("Failed to connect to peer {}: {}", peer.getId(), t);
} }
logConnections(); logConnections();
}); });
@ -312,7 +312,7 @@ public final class NettyP2PNetwork implements P2PNetwork {
} }
private void logConnections() { private void logConnections() {
LOG.info( LOG.debug(
"Connections: {} pending, {} active connections.", "Connections: {} pending, {} active connections.",
pendingConnections.get(), pendingConnections.get(),
connections.size()); 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)); ctx.channel().writeAndFlush(new OutboundMessage(capability, message));
} }
@ -108,7 +108,7 @@ final class NettyPeerConnection implements PeerConnection {
@Override @Override
public void terminateConnection(final DisconnectReason reason, final boolean peerInitiated) { public void terminateConnection(final DisconnectReason reason, final boolean peerInitiated) {
if (disconnectDispatched.compareAndSet(false, true)) { if (disconnectDispatched.compareAndSet(false, true)) {
LOG.info("Disconnected ({}) from {}", reason, peerInfo); LOG.debug("Disconnected ({}) from {}", reason, peerInfo);
callbacks.invokeDisconnect(this, reason, peerInitiated); callbacks.invokeDisconnect(this, reason, peerInitiated);
disconnected.set(true); disconnected.set(true);
} }
@ -120,7 +120,7 @@ final class NettyPeerConnection implements PeerConnection {
@Override @Override
public void disconnect(final DisconnectReason reason) { public void disconnect(final DisconnectReason reason) {
if (disconnectDispatched.compareAndSet(false, true)) { if (disconnectDispatched.compareAndSet(false, true)) {
LOG.info("Disconnecting ({}) from {}", reason, peerInfo); LOG.debug("Disconnecting ({}) from {}", reason, peerInfo);
callbacks.invokeDisconnect(this, reason, false); callbacks.invokeDisconnect(this, reason, false);
try { try {
send(null, DisconnectMessage.create(reason)); send(null, DisconnectMessage.create(reason));

Loading…
Cancel
Save