diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolLogger.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolLogger.java new file mode 100644 index 0000000000..0b57488b19 --- /dev/null +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolLogger.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); + } +} diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java index 3ce95da438..1bee6a0205 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManager.java @@ -239,7 +239,7 @@ public class EthProtocolManager implements ProtocolManager, MinedBlockObserver { "Unsupported capability passed to processMessage(): " + cap); final MessageData messageData = message.getData(); final int code = messageData.getCode(); - LOG.trace("Process message {}, {}", cap, code); + EthProtocolLogger.logProcessMessage(cap, code); final EthPeer ethPeer = ethPeers.peer(message.getConnection()); if (ethPeer == null) { LOG.debug( diff --git a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/internal/DiscoveryProtocolLogger.java b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/internal/DiscoveryProtocolLogger.java index 5510354a5d..30f2c21945 100644 --- a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/internal/DiscoveryProtocolLogger.java +++ b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/discovery/internal/DiscoveryProtocolLogger.java @@ -47,7 +47,7 @@ public class DiscoveryProtocolLogger { void logSendingPacket(final Peer peer, final Packet packet) { outgoingMessageCounter.labels(packet.getType().name()).inc(); LOG.trace( - "<<< Sending {} packet to peer {} ({}): {}", + "<<< Sending {} packet to peer {} ({}): {}", shortenPacketType(packet), peer.getId().slice(0, 16), peer.getEnodeURL(), diff --git a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/rlpx/connections/RlpxConnection.java b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/rlpx/connections/RlpxConnection.java index ae0ba7f4b4..bd05f0709c 100644 --- a/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/rlpx/connections/RlpxConnection.java +++ b/ethereum/p2p/src/main/java/org/hyperledger/besu/ethereum/p2p/rlpx/connections/RlpxConnection.java @@ -149,7 +149,9 @@ public abstract class RlpxConnection { return "RemotelyInitiatedRlpxConnection initiatedAt:" + getInitiatedAt() + " to " - + peerConnection.getPeer().getId(); + + peerConnection.getPeer().getId() + + " disconnected? " + + isFailedOrDisconnected(); } }