Refactor - eliminate non-constant string concatenation from debug and trace (#7336)

* eliminate non-constant string concatenation from debug and trace

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

* adjustments

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>

---------

Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
pull/7352/head
Sally MacFarlane 4 months ago committed by GitHub
parent cee973d429
commit 39e276fd10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      besu/src/main/java/org/hyperledger/besu/Runner.java
  2. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/chain/ChainDataPruner.java
  3. 12
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/trie/diffbased/common/DiffBasedWorldStateProvider.java
  4. 6
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthPeer.java
  5. 7
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/EthScheduler.java
  6. 9
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapProtocolManager.java
  7. 5
      nat/src/main/java/org/hyperledger/besu/nat/upnp/UpnpNatManager.java

@ -253,7 +253,7 @@ public class Runner implements AutoCloseable {
try {
shutdown.await();
} catch (final InterruptedException e) {
LOG.debug("Interrupted while waiting for service " + serviceName + " to stop", e);
LOG.debug("Interrupted while waiting for service {} to stop {}", serviceName, e);
Thread.currentThread().interrupt();
}
}

@ -76,7 +76,7 @@ public class ChainDataPruner implements BlockAddedObserver {
if (event.isNewCanonicalHead() && blocksToBePruned >= pruningFrequency) {
long currentRetainedBlock = blockNumber - currentPruningMark + 1;
while (currentRetainedBlock > blocksToRetain) {
LOG.debug("Pruning chain data with block height of " + currentPruningMark);
LOG.debug("Pruning chain data with block height of {}", currentPruningMark);
pruneChainDataAtBlock(pruningTransaction, currentPruningMark);
currentPruningMark++;
currentRetainedBlock = blockNumber - currentPruningMark;

@ -230,12 +230,12 @@ public abstract class DiffBasedWorldStateProvider implements WorldStateArchive {
} catch (final Exception e) {
// if we fail we must clean up the updater
diffBasedUpdater.reset();
LOG.debug(
"State rolling failed on "
+ mutableState.getWorldStateStorage().getClass().getSimpleName()
+ " for block hash "
+ blockHash,
e);
LOG.atDebug()
.setMessage("State rolling failed on {} for block hash {}")
.addArgument(mutableState.getWorldStateStorage().getClass().getSimpleName())
.addArgument(blockHash)
.addArgument(e)
.log();
return Optional.empty();
}

@ -710,7 +710,11 @@ public class EthPeer implements Comparable<EthPeer> {
}
}
// Otherwise, keep older connection
LOG.trace("comparing timestamps " + a.getInitiatedAt() + " with " + b.getInitiatedAt());
LOG.atTrace()
.setMessage("comparing timestamps {} with {}")
.addArgument(a.getInitiatedAt())
.addArgument(b.getInitiatedAt())
.log();
return a.getInitiatedAt() < b.getInitiatedAt() ? -1 : 1;
}

@ -243,7 +243,7 @@ public class EthScheduler {
public void stop() {
if (stopped.compareAndSet(false, true)) {
LOG.trace("Stopping " + getClass().getSimpleName());
LOG.atTrace().setMessage("Stopping {}").addArgument(getClass().getSimpleName()).log();
syncWorkerExecutor.shutdownNow();
txWorkerExecutor.shutdownNow();
scheduler.shutdownNow();
@ -251,7 +251,10 @@ public class EthScheduler {
computationExecutor.shutdownNow();
shutdown.countDown();
} else {
LOG.trace("Attempted to stop already stopped " + getClass().getSimpleName());
LOG.atTrace()
.setMessage("Attempted to stop already stopped {}")
.addArgument(getClass().getSimpleName())
.log();
}
}

@ -97,7 +97,7 @@ public class SnapProtocolManager implements ProtocolManager {
final EthPeer ethPeer = ethPeers.peer(message.getConnection());
if (ethPeer == null) {
LOG.debug(
"Ignoring message received from unknown peer connection: " + message.getConnection());
"Ignoring message received from unknown peer connection: {}", message.getConnection());
return;
}
final EthMessage ethMessage = new EthMessage(ethPeer, messageData);
@ -132,9 +132,10 @@ public class SnapProtocolManager implements ProtocolManager {
try {
ethPeer.send(responseData, getSupportedProtocol());
} catch (final PeerConnection.PeerNotConnected error) {
// Peer disconnected before we could respond - nothing to do
LOG.trace(
"Peer disconnected before we could respond - nothing to do " + error.getMessage());
LOG.atTrace()
.setMessage("Peer disconnected before we could respond - nothing to do {}")
.addArgument(error.getMessage())
.log();
}
});
}

@ -101,7 +101,10 @@ public class UpnpNatManager extends AbstractNatManager {
new BesuUpnpRegistryListener() {
@Override
public void remoteDeviceAdded(final Registry registry, final RemoteDevice device) {
LOG.debug("UPnP Device discovered: " + device.getDetails().getFriendlyName());
LOG.atDebug()
.setMessage("UPnP Device discovered: {}")
.addArgument(device.getDetails().getFriendlyName())
.log();
inspectDeviceRecursive(device, recognizedServices.keySet());
}
};

Loading…
Cancel
Save