Peering logging (#4142)

* log connected/disconnected state of RemotelyInitiatedConnections
* separate class for logging process message

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
pull/4150/head
Sally MacFarlane 2 years ago committed by GitHub
parent d0c71c3bdc
commit 60895a8166
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolLogger.java
  2. 2
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java
  3. 2
      ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/internal/DiscoveryProtocolLogger.java
  4. 4
      ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/rlpx/connections/RlpxConnection.java

@ -0,0 +1,28 @@
/*
* Copyright Contributors to Hyperledger Besu.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.eth.manager;
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.Capability;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class EthProtocolLogger {
private static final Logger LOG = LoggerFactory.getLogger(EthProtocolLogger.class);
public static void logProcessMessage(final Capability cap, final int code) {
LOG.trace("Process message {}, {}", cap, code);
}
}

@ -239,7 +239,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver {
"Unsupported capability passed to processMessage(): " + cap); "Unsupported capability passed to processMessage(): " + cap);
final MessageData messageData = message.getData(); final MessageData messageData = message.getData();
final int code = messageData.getCode(); final int code = messageData.getCode();
LOG.trace("Process message {}, {}", cap, code); EthProtocolLogger.logProcessMessage(cap, code);
final EthPeer ethPeer = ethPeers.peer(message.getConnection()); final EthPeer ethPeer = ethPeers.peer(message.getConnection());
if (ethPeer == null) { if (ethPeer == null) {
LOG.debug( LOG.debug(

@ -47,7 +47,7 @@ public class DiscoveryProtocolLogger {
void logSendingPacket(final Peer peer, final Packet packet) { void logSendingPacket(final Peer peer, final Packet packet) {
outgoingMessageCounter.labels(packet.getType().name()).inc(); outgoingMessageCounter.labels(packet.getType().name()).inc();
LOG.trace( LOG.trace(
"<<< Sending {} packet to peer {} ({}): {}", "<<< Sending {} packet to peer {} ({}): {}",
shortenPacketType(packet), shortenPacketType(packet),
peer.getId().slice(0, 16), peer.getId().slice(0, 16),
peer.getEnodeURL(), peer.getEnodeURL(),

@ -149,7 +149,9 @@ public abstract class RlpxConnection {
return "RemotelyInitiatedRlpxConnection initiatedAt:" return "RemotelyInitiatedRlpxConnection initiatedAt:"
+ getInitiatedAt() + getInitiatedAt()
+ " to " + " to "
+ peerConnection.getPeer().getId(); + peerConnection.getPeer().getId()
+ " disconnected? "
+ isFailedOrDisconnected();
} }
} }

Loading…
Cancel
Save