Introduce SLF4J for logging (#3285)

* Bump SLF4J version

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Replace log4j2 API with SLF4j API

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Replace usage of LogManager#getFormatterLogger

This is for keeping compatibility with SLF4J. If neccesary, a specific formatter can be created for the RlpBlockImporter class

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Unset the default logging value for the retesteth

This is because it's not possible to resolve the root logger level into a Log4J2 field

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Prevent creation of Logger context outside SLF4J

org.hyperledger.besu.cli.BesuCommand#setAllLevels was taken from
https://github.com/apache/logging-log4j2/blob/rel%2F2.17.1/log4j-core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java#L309

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Add FATAL level deprecation message

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* [Sonar] Fix java:S2139

Exceptions should be either logged or rethrown but not both

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* [Sonar] Fix java:S3457

Printf-style format strings should be used correctly

Signed-off-by: Diego López León <dieguitoll@gmail.com>

* Add changelog

Signed-off-by: Diego López León <dieguitoll@gmail.com>
pull/3327/head
Diego López León 3 years ago committed by GitHub
parent e7ccb33061
commit ed1329cf84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 3
      acceptance-tests/dsl/build.gradle
  3. 6
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/AcceptanceTestBase.java
  4. 6
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/condition/process/ExitedWithCode.java
  5. 6
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java
  6. 14
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java
  7. 16
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java
  8. 6
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/cluster/Cluster.java
  9. 6
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivacyCluster.java
  10. 6
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/privacy/PrivacyNode.java
  11. 4
      acceptance-tests/test-plugins/build.gradle
  12. 6
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/BadCLIOptionsPlugin.java
  13. 6
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestBesuEventsPlugin.java
  14. 6
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPermissioningPlugin.java
  15. 6
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPicoCLIPlugin.java
  16. 6
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/TestPrivacyServicePlugin.java
  17. 6
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/privacy/TestPrivacyPluginPayloadProvider.java
  18. 7
      acceptance-tests/test-plugins/src/main/java/org/hyperledger/besu/tests/acceptance/plugins/privacy/TestSigningPrivateMarkerTransactionFactory.java
  19. 5
      besu/build.gradle
  20. 15
      besu/src/main/java/org/hyperledger/besu/Besu.java
  21. 12
      besu/src/main/java/org/hyperledger/besu/Runner.java
  22. 6
      besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
  23. 6
      besu/src/main/java/org/hyperledger/besu/chainexport/BlockExporter.java
  24. 6
      besu/src/main/java/org/hyperledger/besu/chainimport/JsonBlockImporter.java
  25. 8
      besu/src/main/java/org/hyperledger/besu/chainimport/RlpBlockImporter.java
  26. 23
      besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
  27. 9
      besu/src/main/java/org/hyperledger/besu/cli/logging/XmlExtensionConfiguration.java
  28. 44
      besu/src/main/java/org/hyperledger/besu/cli/options/stable/LoggingLevelOption.java
  29. 2
      besu/src/main/java/org/hyperledger/besu/cli/options/stable/P2PTLSConfigOptions.java
  30. 2
      besu/src/main/java/org/hyperledger/besu/cli/options/unstable/PkiBlockCreationOptions.java
  31. 6
      besu/src/main/java/org/hyperledger/besu/cli/subcommands/PublicKeySubCommand.java
  32. 22
      besu/src/main/java/org/hyperledger/besu/cli/subcommands/RetestethSubCommand.java
  33. 6
      besu/src/main/java/org/hyperledger/besu/cli/subcommands/blocks/BlocksSubCommand.java
  34. 6
      besu/src/main/java/org/hyperledger/besu/cli/subcommands/operator/GenerateBlockchainConfig.java
  35. 6
      besu/src/main/java/org/hyperledger/besu/cli/subcommands/operator/RestoreState.java
  36. 2
      besu/src/main/java/org/hyperledger/besu/cli/util/CommandLineUtils.java
  37. 6
      besu/src/main/java/org/hyperledger/besu/controller/BesuController.java
  38. 6
      besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
  39. 6
      besu/src/main/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilder.java
  40. 6
      besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java
  41. 6
      besu/src/main/java/org/hyperledger/besu/controller/IbftLegacyBesuControllerBuilder.java
  42. 6
      besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java
  43. 6
      besu/src/main/java/org/hyperledger/besu/services/BesuPluginContextImpl.java
  44. 6
      besu/src/main/java/org/hyperledger/besu/services/PicoCLIOptionsImpl.java
  45. 6
      besu/src/main/java/org/hyperledger/besu/services/PrivacyPluginServiceImpl.java
  46. 2
      besu/src/test/java/org/hyperledger/besu/cli/CommandLineUtilsTest.java
  47. 6
      besu/src/test/java/org/hyperledger/besu/cli/CommandTestAbstract.java
  48. 2
      build.gradle
  49. 4
      config/build.gradle
  50. 6
      consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueExtraData.java
  51. 7
      consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMiningCoordinator.java
  52. 6
      consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/headervalidationrules/CliqueDifficultyValidationRule.java
  53. 6
      consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/headervalidationrules/CliqueExtraDataValidationRule.java
  54. 6
      consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/headervalidationrules/CoinbaseHeaderValidationRule.java
  55. 6
      consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/headervalidationrules/SignerRateLimitValidationRule.java
  56. 6
      consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/headervalidationrules/VoteValidationRule.java
  57. 7
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/MigratingMiningCoordinator.java
  58. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BftEventQueue.java
  59. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BftExecutors.java
  60. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BftExtraDataCodec.java
  61. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BftProcessor.java
  62. 7
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/EthSynchronizerUpdater.java
  63. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/EventMultiplexer.java
  64. 7
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftMiningCoordinator.java
  65. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/ProposerSelector.java
  66. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/headervalidationrules/BftCoinbaseValidationRule.java
  67. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/headervalidationrules/BftCommitSealsValidationRule.java
  68. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/headervalidationrules/BftValidatorsValidationRule.java
  69. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/headervalidationrules/BftVanityDataValidationRule.java
  70. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/network/ValidatorPeers.java
  71. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/protocol/BftProtocolManager.java
  72. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/statemachine/BaseBftController.java
  73. 6
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/validator/blockbased/VoteTallyUpdater.java
  74. 6
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/jsonrpc/methods/IbftDiscardValidatorVote.java
  75. 6
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/jsonrpc/methods/IbftGetValidatorsByBlockHash.java
  76. 6
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/jsonrpc/methods/IbftGetValidatorsByBlockNumber.java
  77. 6
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/jsonrpc/methods/IbftProposeValidatorVote.java
  78. 6
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/network/IbftMessageTransmitter.java
  79. 6
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/statemachine/IbftBlockHeightManager.java
  80. 23
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/statemachine/IbftRound.java
  81. 6
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/statemachine/RoundChangeManager.java
  82. 6
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/statemachine/RoundState.java
  83. 7
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/validation/FutureRoundProposalMessageValidator.java
  84. 6
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/validation/MessageValidator.java
  85. 7
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/validation/ProposalBlockConsistencyValidator.java
  86. 6
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/validation/RoundChangeCertificateValidator.java
  87. 6
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/validation/RoundChangeMessageValidator.java
  88. 6
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/validation/RoundChangePayloadValidator.java
  89. 6
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/validation/SignedDataValidator.java
  90. 6
      consensus/ibftlegacy/src/main/java/org/hyperledger/besu/consensus/ibftlegacy/IbftExtraData.java
  91. 6
      consensus/ibftlegacy/src/main/java/org/hyperledger/besu/consensus/ibftlegacy/headervalidationrules/IbftExtraDataValidationRule.java
  92. 6
      consensus/ibftlegacy/src/main/java/org/hyperledger/besu/consensus/ibftlegacy/headervalidationrules/VoteValidationRule.java
  93. 6
      consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/blockcreation/PkiQbftBlockCreator.java
  94. 6
      consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/headervalidationrules/QbftValidatorsValidationRule.java
  95. 6
      consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/jsonrpc/methods/QbftDiscardValidatorVote.java
  96. 6
      consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/jsonrpc/methods/QbftGetValidatorsByBlockHash.java
  97. 6
      consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/jsonrpc/methods/QbftGetValidatorsByBlockNumber.java
  98. 6
      consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/jsonrpc/methods/QbftProposeValidatorVote.java
  99. 6
      consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/network/QbftMessageTransmitter.java
  100. 15
      consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/pki/PkiBlockCreationConfigurationProvider.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -25,6 +25,7 @@
- Re-order external services (e.g JsonRpcHttpService) to start before blocks start processing [#3118](https://github.com/hyperledger/besu/pull/3118) - Re-order external services (e.g JsonRpcHttpService) to start before blocks start processing [#3118](https://github.com/hyperledger/besu/pull/3118)
- Stream JSON RPC responses to avoid creating big JSON strings in memory [#3076](https://github.com/hyperledger/besu/pull/3076) - Stream JSON RPC responses to avoid creating big JSON strings in memory [#3076](https://github.com/hyperledger/besu/pull/3076)
- Ethereum Classic Mystique Hard Fork [#3256](https://github.com/hyperledger/besu/pull/3256) - Ethereum Classic Mystique Hard Fork [#3256](https://github.com/hyperledger/besu/pull/3256)
- Move into SLF4J as logging facade [#3285](https://github.com/hyperledger/besu/pull/3285)
### Bug Fixes ### Bug Fixes
- Make 'to' field optional in eth_call method according to the spec [#3177](https://github.com/hyperledger/besu/pull/3177) - Make 'to' field optional in eth_call method according to the spec [#3177](https://github.com/hyperledger/besu/pull/3177)

@ -33,9 +33,6 @@ dependencies {
implementation 'io.reactivex.rxjava2:rxjava' implementation 'io.reactivex.rxjava2:rxjava'
implementation 'io.vertx:vertx-core' implementation 'io.vertx:vertx-core'
implementation 'junit:junit' implementation 'junit:junit'
implementation 'org.apache.logging.log4j:log4j-api'
implementation 'org.apache.logging.log4j:log4j-core'
implementation 'org.apache.logging.log4j:log4j-slf4j-impl'
implementation 'org.apache.tuweni:tuweni-bytes' implementation 'org.apache.tuweni:tuweni-bytes'
implementation 'org.apache.tuweni:tuweni-io' implementation 'org.apache.tuweni:tuweni-io'
implementation 'org.apache.tuweni:tuweni-units' implementation 'org.apache.tuweni:tuweni-units'

@ -57,18 +57,18 @@ import java.math.BigInteger;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.ThreadContext; import org.apache.logging.log4j.ThreadContext;
import org.junit.After; import org.junit.After;
import org.junit.Rule; import org.junit.Rule;
import org.junit.rules.TestName; import org.junit.rules.TestName;
import org.junit.rules.TestWatcher; import org.junit.rules.TestWatcher;
import org.junit.runner.Description; import org.junit.runner.Description;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AcceptanceTestBase { public class AcceptanceTestBase {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(AcceptanceTestBase.class);
protected final Accounts accounts; protected final Accounts accounts;
protected final AccountTransactions accountTransactions; protected final AccountTransactions accountTransactions;

@ -22,12 +22,12 @@ import org.hyperledger.besu.tests.acceptance.dsl.node.RunnableNode;
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class ExitedWithCode implements Condition { public class ExitedWithCode implements Condition {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(ExitedWithCode.class);
private final int code; private final int code;

@ -15,7 +15,6 @@
package org.hyperledger.besu.tests.acceptance.dsl.node; package org.hyperledger.besu.tests.acceptance.dsl.node;
import static java.util.Collections.unmodifiableList; import static java.util.Collections.unmodifiableList;
import static org.apache.logging.log4j.LogManager.getLogger;
import static org.apache.tuweni.io.file.Files.copyResource; import static org.apache.tuweni.io.file.Files.copyResource;
import org.hyperledger.besu.cli.config.NetworkName; import org.hyperledger.besu.cli.config.NetworkName;
@ -66,10 +65,11 @@ import java.util.concurrent.TimeUnit;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.google.common.io.MoreFiles; import com.google.common.io.MoreFiles;
import com.google.common.io.RecursiveDeleteOption; import com.google.common.io.RecursiveDeleteOption;
import org.apache.logging.log4j.Logger;
import org.awaitility.Awaitility; import org.awaitility.Awaitility;
import org.awaitility.core.ConditionTimeoutException; import org.awaitility.core.ConditionTimeoutException;
import org.java_websocket.exceptions.WebsocketNotConnectedException; import org.java_websocket.exceptions.WebsocketNotConnectedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.web3j.protocol.Web3jService; import org.web3j.protocol.Web3jService;
import org.web3j.protocol.core.JsonRpc2_0Web3j; import org.web3j.protocol.core.JsonRpc2_0Web3j;
import org.web3j.protocol.http.HttpService; import org.web3j.protocol.http.HttpService;
@ -81,7 +81,7 @@ import org.web3j.utils.Async;
public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable { public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable {
private static final String LOCALHOST = "127.0.0.1"; private static final String LOCALHOST = "127.0.0.1";
private static final Logger LOG = getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BesuNode.class);
private final Path homeDirectory; private final Path homeDirectory;
private KeyPair keyPair; private KeyPair keyPair;

@ -46,15 +46,15 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.ThreadContext; import org.slf4j.MDC;
public class ProcessBesuNodeRunner implements BesuNodeRunner { public class ProcessBesuNodeRunner implements BesuNodeRunner {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(ProcessBesuNodeRunner.class);
private static final Logger PROCESS_LOG = private static final Logger PROCESS_LOG =
LogManager.getLogger("org.hyperledger.besu.SubProcessLog"); LoggerFactory.getLogger("org.hyperledger.besu.SubProcessLog");
private final Map<String, Process> besuProcesses = new HashMap<>(); private final Map<String, Process> besuProcesses = new HashMap<>();
private final ExecutorService outputProcessorExecutor = Executors.newCachedThreadPool(); private final ExecutorService outputProcessorExecutor = Executors.newCachedThreadPool();
@ -410,7 +410,7 @@ public class ProcessBesuNodeRunner implements BesuNodeRunner {
waitForFile(dataDir, "besu.ports"); waitForFile(dataDir, "besu.ports");
waitForFile(dataDir, "besu.networks"); waitForFile(dataDir, "besu.networks");
} }
ThreadContext.remove("node"); MDC.remove("node");
} }
private boolean isNotAliveOrphan(final String name) { private boolean isNotAliveOrphan(final String name) {
@ -422,7 +422,7 @@ public class ProcessBesuNodeRunner implements BesuNodeRunner {
try (final BufferedReader in = try (final BufferedReader in =
new BufferedReader(new InputStreamReader(process.getInputStream(), UTF_8))) { new BufferedReader(new InputStreamReader(process.getInputStream(), UTF_8))) {
ThreadContext.put("node", node.getName()); MDC.put("node", node.getName());
String line = in.readLine(); String line = in.readLine();
while (line != null) { while (line != null) {

@ -65,15 +65,15 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import io.vertx.core.Vertx; import io.vertx.core.Vertx;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.ThreadContext; import org.slf4j.MDC;
import picocli.CommandLine; import picocli.CommandLine;
import picocli.CommandLine.Model.CommandSpec; import picocli.CommandLine.Model.CommandSpec;
public class ThreadBesuNodeRunner implements BesuNodeRunner { public class ThreadBesuNodeRunner implements BesuNodeRunner {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(ThreadBesuNodeRunner.class);
private final Map<String, Runner> besuRunners = new HashMap<>(); private final Map<String, Runner> besuRunners = new HashMap<>();
private final Map<Node, BesuPluginContextImpl> besuPluginContextMap = new ConcurrentHashMap<>(); private final Map<Node, BesuPluginContextImpl> besuPluginContextMap = new ConcurrentHashMap<>();
@ -111,10 +111,10 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {
@Override @Override
public void startNode(final BesuNode node) { public void startNode(final BesuNode node) {
if (ThreadContext.containsKey("node")) { if (MDC.get("node") != null) {
LOG.error("ThreadContext node is already set to {}", ThreadContext.get("node")); LOG.error("ThreadContext node is already set to {}", MDC.get("node"));
} }
ThreadContext.put("node", node.getName()); MDC.put("node", node.getName());
if (!node.getRunCommand().isEmpty()) { if (!node.getRunCommand().isEmpty()) {
throw new UnsupportedOperationException("commands are not supported with thread runner"); throw new UnsupportedOperationException("commands are not supported with thread runner");
@ -229,7 +229,7 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {
runner.startEthereumMainLoop(); runner.startEthereumMainLoop();
besuRunners.put(node.getName(), runner); besuRunners.put(node.getName(), runner);
ThreadContext.remove("node"); MDC.remove("node");
} }
@Override @Override

@ -33,11 +33,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class Cluster implements AutoCloseable { public class Cluster implements AutoCloseable {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(Cluster.class);
private final Map<String, RunnableNode> nodes = new HashMap<>(); private final Map<String, RunnableNode> nodes = new HashMap<>();
private final BesuNodeRunner besuNodeRunner; private final BesuNodeRunner besuNodeRunner;

@ -30,11 +30,11 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class PrivacyCluster { public class PrivacyCluster {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(PrivacyCluster.class);
private final NetConditions net; private final NetConditions net;
private final BesuNodeRunner besuNodeRunner; private final BesuNodeRunner besuNodeRunner;

@ -57,14 +57,14 @@ import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import io.vertx.core.Vertx; import io.vertx.core.Vertx;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.awaitility.Awaitility; import org.awaitility.Awaitility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.Network; import org.testcontainers.containers.Network;
public class PrivacyNode implements AutoCloseable { public class PrivacyNode implements AutoCloseable {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(PrivacyNode.class);
private static final int MAX_OPEN_FILES = 1024; private static final int MAX_OPEN_FILES = 1024;
private static final long CACHE_CAPACITY = 8388608; private static final long CACHE_CAPACITY = 8388608;
private static final int MAX_BACKGROUND_COMPACTIONS = 4; private static final int MAX_BACKGROUND_COMPACTIONS = 4;

@ -1,5 +1,7 @@
dependencies { dependencies {
api 'org.slf4j:slf4j-api'
implementation project(':besu') implementation project(':besu')
implementation project(':crypto') implementation project(':crypto')
implementation project(':datatypes') implementation project(':datatypes')
@ -8,8 +10,6 @@ dependencies {
implementation project(':plugin-api') implementation project(':plugin-api')
implementation 'com.google.auto.service:auto-service' implementation 'com.google.auto.service:auto-service'
implementation 'info.picocli:picocli' implementation 'info.picocli:picocli'
implementation 'org.apache.logging.log4j:log4j-api'
implementation 'org.apache.logging.log4j:log4j-core'
testImplementation 'org.assertj:assertj-core' testImplementation 'org.assertj:assertj-core'
testImplementation 'junit:junit' testImplementation 'junit:junit'

@ -26,13 +26,13 @@ import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import com.google.auto.service.AutoService; import com.google.auto.service.AutoService;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
import picocli.CommandLine.Option; import picocli.CommandLine.Option;
@AutoService(BesuPlugin.class) @AutoService(BesuPlugin.class)
public class BadCLIOptionsPlugin implements BesuPlugin { public class BadCLIOptionsPlugin implements BesuPlugin {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BadCLIOptionsPlugin.class);
@Option(names = "--poorly-named-option") @Option(names = "--poorly-named-option")
String poorlyNamedOption = "nothing"; String poorlyNamedOption = "nothing";

@ -28,12 +28,12 @@ import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import com.google.auto.service.AutoService; import com.google.auto.service.AutoService;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
@AutoService(BesuPlugin.class) @AutoService(BesuPlugin.class)
public class TestBesuEventsPlugin implements BesuPlugin { public class TestBesuEventsPlugin implements BesuPlugin {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(TestBesuEventsPlugin.class);
private BesuContext context; private BesuContext context;

@ -21,13 +21,13 @@ import org.hyperledger.besu.plugin.services.PermissioningService;
import org.hyperledger.besu.plugin.services.PicoCLIOptions; import org.hyperledger.besu.plugin.services.PicoCLIOptions;
import com.google.auto.service.AutoService; import com.google.auto.service.AutoService;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
import picocli.CommandLine.Option; import picocli.CommandLine.Option;
@AutoService(BesuPlugin.class) @AutoService(BesuPlugin.class)
public class TestPermissioningPlugin implements BesuPlugin { public class TestPermissioningPlugin implements BesuPlugin {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(TestPermissioningPlugin.class);
private static final String aliceNode = private static final String aliceNode =
"09b02f8a5fddd222ade4ea4528faefc399623af3f736be3c44f03e2df22fb792f3931a4d9573d333ca74343305762a753388c3422a86d98b713fc91c1ea04842"; "09b02f8a5fddd222ade4ea4528faefc399623af3f736be3c44f03e2df22fb792f3931a4d9573d333ca74343305762a753388c3422a86d98b713fc91c1ea04842";

@ -24,13 +24,13 @@ import java.nio.file.Files;
import java.util.Collections; import java.util.Collections;
import com.google.auto.service.AutoService; import com.google.auto.service.AutoService;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
import picocli.CommandLine.Option; import picocli.CommandLine.Option;
@AutoService(BesuPlugin.class) @AutoService(BesuPlugin.class)
public class TestPicoCLIPlugin implements BesuPlugin { public class TestPicoCLIPlugin implements BesuPlugin {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(TestPicoCLIPlugin.class);
@Option( @Option(
names = {"--Xplugin-test-option"}, names = {"--Xplugin-test-option"},

@ -23,13 +23,13 @@ import org.hyperledger.besu.tests.acceptance.plugins.privacy.TestPrivacyPluginPa
import org.hyperledger.besu.tests.acceptance.plugins.privacy.TestSigningPrivateMarkerTransactionFactory; import org.hyperledger.besu.tests.acceptance.plugins.privacy.TestSigningPrivateMarkerTransactionFactory;
import com.google.auto.service.AutoService; import com.google.auto.service.AutoService;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
import picocli.CommandLine.Option; import picocli.CommandLine.Option;
@AutoService(BesuPlugin.class) @AutoService(BesuPlugin.class)
public class TestPrivacyServicePlugin implements BesuPlugin { public class TestPrivacyServicePlugin implements BesuPlugin {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(TestPrivacyServicePlugin.class);
PrivacyPluginService pluginService; PrivacyPluginService pluginService;
BesuContext context; BesuContext context;

@ -25,12 +25,12 @@ import org.hyperledger.besu.plugin.services.privacy.PrivacyPluginPayloadProvider
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TestPrivacyPluginPayloadProvider implements PrivacyPluginPayloadProvider { public class TestPrivacyPluginPayloadProvider implements PrivacyPluginPayloadProvider {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(TestPrivacyPluginPayloadProvider.class);
private String prefix; private String prefix;
public void setPluginPayloadPrefix(final String prefix) { public void setPluginPayloadPrefix(final String prefix) {

@ -14,7 +14,6 @@
*/ */
package org.hyperledger.besu.tests.acceptance.plugins.privacy; package org.hyperledger.besu.tests.acceptance.plugins.privacy;
import static org.apache.logging.log4j.LogManager.getLogger;
import static org.hyperledger.besu.datatypes.Address.extract; import static org.hyperledger.besu.datatypes.Address.extract;
import org.hyperledger.besu.crypto.KeyPair; import org.hyperledger.besu.crypto.KeyPair;
@ -31,13 +30,15 @@ import org.hyperledger.besu.plugin.data.TransactionType;
import org.hyperledger.besu.plugin.data.UnsignedPrivateMarkerTransaction; import org.hyperledger.besu.plugin.data.UnsignedPrivateMarkerTransaction;
import org.hyperledger.besu.plugin.services.privacy.PrivateMarkerTransactionFactory; import org.hyperledger.besu.plugin.services.privacy.PrivateMarkerTransactionFactory;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.bytes.Bytes32;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TestSigningPrivateMarkerTransactionFactory implements PrivateMarkerTransactionFactory { public class TestSigningPrivateMarkerTransactionFactory implements PrivateMarkerTransactionFactory {
private static final Logger LOG = getLogger(); private static final Logger LOG =
LoggerFactory.getLogger(TestSigningPrivateMarkerTransactionFactory.class);
KeyPair aliceFixedSigningKey; KeyPair aliceFixedSigningKey;
Address sender; Address sender;

@ -28,6 +28,8 @@ jar {
} }
dependencies { dependencies {
api 'org.slf4j:slf4j-api'
implementation project(':config') implementation project(':config')
implementation project(':pki') implementation project(':pki')
implementation project(':consensus:clique') implementation project(':consensus:clique')
@ -56,6 +58,7 @@ dependencies {
implementation project(':plugin-api') implementation project(':plugin-api')
implementation project(':plugins:rocksdb') implementation project(':plugins:rocksdb')
implementation project(':services:kvstore') implementation project(':services:kvstore')
implementation project(':util')
implementation 'com.fasterxml.jackson.core:jackson-databind' implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8'
@ -64,7 +67,6 @@ dependencies {
implementation 'info.picocli:picocli' implementation 'info.picocli:picocli'
implementation 'io.vertx:vertx-core' implementation 'io.vertx:vertx-core'
implementation 'io.vertx:vertx-web' implementation 'io.vertx:vertx-web'
implementation 'org.apache.logging.log4j:log4j-api'
implementation 'org.apache.logging.log4j:log4j-core' implementation 'org.apache.logging.log4j:log4j-core'
implementation 'org.apache.tuweni:tuweni-bytes' implementation 'org.apache.tuweni:tuweni-bytes'
implementation 'org.apache.tuweni:tuweni-config' implementation 'org.apache.tuweni:tuweni-config'
@ -74,7 +76,6 @@ dependencies {
implementation 'org.xerial.snappy:snappy-java' implementation 'org.xerial.snappy:snappy-java'
implementation 'net.consensys.services:quorum-mainnet-launcher' implementation 'net.consensys.services:quorum-mainnet-launcher'
runtimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl'
runtimeOnly 'org.apache.logging.log4j:log4j-jul' runtimeOnly 'org.apache.logging.log4j:log4j-jul'
runtimeOnly 'com.splunk.logging:splunk-library-javalogging' runtimeOnly 'com.splunk.logging:splunk-library-javalogging'
runtimeOnly 'org.fusesource.jansi:jansi' // for color logging in windows runtimeOnly 'org.fusesource.jansi:jansi' // for color logging in windows

@ -14,8 +14,6 @@
*/ */
package org.hyperledger.besu; package org.hyperledger.besu;
import static org.apache.logging.log4j.LogManager.getLogger;
import org.hyperledger.besu.chainexport.RlpBlockExporter; import org.hyperledger.besu.chainexport.RlpBlockExporter;
import org.hyperledger.besu.chainimport.JsonBlockImporter; import org.hyperledger.besu.chainimport.JsonBlockImporter;
import org.hyperledger.besu.chainimport.RlpBlockImporter; import org.hyperledger.besu.chainimport.RlpBlockImporter;
@ -26,7 +24,8 @@ import org.hyperledger.besu.services.BesuPluginContextImpl;
import io.netty.util.internal.logging.InternalLoggerFactory; import io.netty.util.internal.logging.InternalLoggerFactory;
import io.netty.util.internal.logging.Log4J2LoggerFactory; import io.netty.util.internal.logging.Log4J2LoggerFactory;
import org.apache.logging.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.RunLast; import picocli.CommandLine.RunLast;
public final class Besu { public final class Besu {
@ -68,7 +67,7 @@ public final class Besu {
"Could not set logging system property as the security manager prevented it:" "Could not set logging system property as the security manager prevented it:"
+ e.getMessage()); + e.getMessage());
} }
final Logger logger = getLogger(); final Logger logger = LoggerFactory.getLogger(Besu.class);
Thread.setDefaultUncaughtExceptionHandler(log4jExceptionHandler(logger)); Thread.setDefaultUncaughtExceptionHandler(log4jExceptionHandler(logger));
Thread.currentThread().setUncaughtExceptionHandler(log4jExceptionHandler(logger)); Thread.currentThread().setUncaughtExceptionHandler(log4jExceptionHandler(logger));
@ -76,8 +75,10 @@ public final class Besu {
} }
private static Thread.UncaughtExceptionHandler log4jExceptionHandler(final Logger logger) { private static Thread.UncaughtExceptionHandler log4jExceptionHandler(final Logger logger) {
return (thread, error) -> return (thread, error) -> {
logger.error( if (logger.isErrorEnabled()) {
() -> String.format("Uncaught exception in thread \"%s\"", thread.getName()), error); logger.error(String.format("Uncaught exception in thread \"%s\"", thread.getName()), error);
}
};
} }
} }

@ -46,12 +46,12 @@ import java.util.concurrent.TimeoutException;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import io.vertx.core.Vertx; import io.vertx.core.Vertx;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class Runner implements AutoCloseable { public class Runner implements AutoCloseable {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(Runner.class);
private final Vertx vertx; private final Vertx vertx;
private final CountDownLatch vertxShutdownLatch = new CountDownLatch(1); private final CountDownLatch vertxShutdownLatch = new CountDownLatch(1);
@ -135,8 +135,7 @@ public class Runner implements AutoCloseable {
writeBesuNetworksToFile(); writeBesuNetworksToFile();
writePidFile(); writePidFile();
} catch (final Exception ex) { } catch (final Exception ex) {
LOG.error("Startup failed", ex); throw new IllegalStateException("Startup failed", ex);
throw new IllegalStateException(ex);
} }
} }
@ -212,8 +211,7 @@ public class Runner implements AutoCloseable {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
throw new IllegalStateException("Interrupted while waiting for service to start", e); throw new IllegalStateException("Interrupted while waiting for service to start", e);
} catch (final ExecutionException e) { } catch (final ExecutionException e) {
LOG.error("Service " + serviceName + " failed to start", e); throw new IllegalStateException("Service " + serviceName + " failed to start", e);
throw new IllegalStateException(e);
} catch (final TimeoutException e) { } catch (final TimeoutException e) {
LOG.warn("Service {} is taking an unusually long time to start", serviceName); LOG.warn("Service {} is taking an unusually long time to start", serviceName);
} }

@ -130,13 +130,13 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import graphql.GraphQL; import graphql.GraphQL;
import io.vertx.core.Vertx; import io.vertx.core.Vertx;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RunnerBuilder { public class RunnerBuilder {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(RunnerBuilder.class);
private Vertx vertx; private Vertx vertx;
private BesuController besuController; private BesuController besuController;

@ -25,12 +25,12 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** Besu Block Export Util. */ /** Besu Block Export Util. */
public abstract class BlockExporter { public abstract class BlockExporter {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BlockExporter.class);
private final Blockchain blockchain; private final Blockchain blockchain;
protected BlockExporter(final Blockchain blockchain) { protected BlockExporter(final Blockchain blockchain) {

@ -40,13 +40,13 @@ import java.util.stream.Stream;
import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** Tool for importing blocks with transactions from human-readable json. */ /** Tool for importing blocks with transactions from human-readable json. */
public class JsonBlockImporter { public class JsonBlockImporter {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(JsonBlockImporter.class);
private final ObjectMapper mapper; private final ObjectMapper mapper;
private final BesuController controller; private final BesuController controller;

@ -45,12 +45,12 @@ import java.util.concurrent.atomic.AtomicReference;
import com.google.common.base.MoreObjects; import com.google.common.base.MoreObjects;
import com.google.common.base.Stopwatch; import com.google.common.base.Stopwatch;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** Tool for importing rlp-encoded block data from files. */ /** Tool for importing rlp-encoded block data from files. */
public class RlpBlockImporter implements Closeable { public class RlpBlockImporter implements Closeable {
private static final Logger LOG = LogManager.getFormatterLogger(); private static final Logger LOG = LoggerFactory.getLogger(RlpBlockImporter.class);
private final Semaphore blockBacklog = new Semaphore(2); private final Semaphore blockBacklog = new Semaphore(2);
@ -237,7 +237,7 @@ public class RlpBlockImporter implements Closeable {
final long elapseMicros = segmentTimer.elapsed(TimeUnit.MICROSECONDS); final long elapseMicros = segmentTimer.elapsed(TimeUnit.MICROSECONDS);
//noinspection PlaceholderCountMatchesArgumentCount //noinspection PlaceholderCountMatchesArgumentCount
LOG.info( LOG.info(
"Import at block %8d / %,14d gas %,11d micros / Mgps %7.3f segment %6.3f cumulative", "Import at block {} / {} gas {} micros / Mgps {} segment {} cumulative",
blockNum, blockNum,
segmentGas, segmentGas,
elapseMicros, elapseMicros,

@ -49,6 +49,7 @@ import org.hyperledger.besu.cli.custom.JsonRPCAllowlistHostsProperty;
import org.hyperledger.besu.cli.custom.RpcAuthFileValidator; import org.hyperledger.besu.cli.custom.RpcAuthFileValidator;
import org.hyperledger.besu.cli.error.BesuExceptionHandler; import org.hyperledger.besu.cli.error.BesuExceptionHandler;
import org.hyperledger.besu.cli.options.stable.EthstatsOptions; import org.hyperledger.besu.cli.options.stable.EthstatsOptions;
import org.hyperledger.besu.cli.options.stable.LoggingLevelOption;
import org.hyperledger.besu.cli.options.stable.NodePrivateKeyFileOption; import org.hyperledger.besu.cli.options.stable.NodePrivateKeyFileOption;
import org.hyperledger.besu.cli.options.stable.P2PTLSConfigOptions; import org.hyperledger.besu.cli.options.stable.P2PTLSConfigOptions;
import org.hyperledger.besu.cli.options.unstable.DataStorageOptions; import org.hyperledger.besu.cli.options.unstable.DataStorageOptions;
@ -172,6 +173,7 @@ import org.hyperledger.besu.services.RpcEndpointServiceImpl;
import org.hyperledger.besu.services.SecurityModuleServiceImpl; import org.hyperledger.besu.services.SecurityModuleServiceImpl;
import org.hyperledger.besu.services.StorageServiceImpl; import org.hyperledger.besu.services.StorageServiceImpl;
import org.hyperledger.besu.services.kvstore.InMemoryStoragePlugin; import org.hyperledger.besu.services.kvstore.InMemoryStoragePlugin;
import org.hyperledger.besu.util.Log4j2ConfiguratorUtil;
import org.hyperledger.besu.util.NetworkUtility; import org.hyperledger.besu.util.NetworkUtility;
import org.hyperledger.besu.util.PermissioningConfigurationValidator; import org.hyperledger.besu.util.PermissioningConfigurationValidator;
import org.hyperledger.besu.util.number.Fraction; import org.hyperledger.besu.util.number.Fraction;
@ -225,11 +227,9 @@ import net.consensys.quorum.mainnet.launcher.config.ImmutableLauncherConfig;
import net.consensys.quorum.mainnet.launcher.exception.LauncherException; import net.consensys.quorum.mainnet.launcher.exception.LauncherException;
import net.consensys.quorum.mainnet.launcher.util.ParseArgsHelper; import net.consensys.quorum.mainnet.launcher.util.ParseArgsHelper;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.config.Configurator;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.units.bigints.UInt256; import org.apache.tuweni.units.bigints.UInt256;
import org.slf4j.Logger;
import picocli.AutoComplete; import picocli.AutoComplete;
import picocli.CommandLine; import picocli.CommandLine;
import picocli.CommandLine.AbstractParseResultHandler; import picocli.CommandLine.AbstractParseResultHandler;
@ -285,6 +285,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
private final EthstatsOptions ethstatsOptions = EthstatsOptions.create(); private final EthstatsOptions ethstatsOptions = EthstatsOptions.create();
private final NodePrivateKeyFileOption nodePrivateKeyFileOption = private final NodePrivateKeyFileOption nodePrivateKeyFileOption =
NodePrivateKeyFileOption.create(); NodePrivateKeyFileOption.create();
private final LoggingLevelOption loggingLevelOption = LoggingLevelOption.create();
private final RunnerBuilder runnerBuilder; private final RunnerBuilder runnerBuilder;
private final BesuController.Builder controllerBuilderFactory; private final BesuController.Builder controllerBuilderFactory;
@ -828,12 +829,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
"Deprecated in favor of --host-allowlist. Comma separated list of hostnames to allow for RPC access, or * to accept any host (default: ${DEFAULT-VALUE})") "Deprecated in favor of --host-allowlist. Comma separated list of hostnames to allow for RPC access, or * to accept any host (default: ${DEFAULT-VALUE})")
private final JsonRPCAllowlistHostsProperty hostsWhitelist = new JsonRPCAllowlistHostsProperty(); private final JsonRPCAllowlistHostsProperty hostsWhitelist = new JsonRPCAllowlistHostsProperty();
@Option(
names = {"--logging", "-l"},
paramLabel = "<LOG VERBOSITY LEVEL>",
description = "Logging verbosity levels: OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL")
private final Level logLevel = null;
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"}) @SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"})
@Option( @Option(
names = {"--color-enabled"}, names = {"--color-enabled"},
@ -1341,6 +1336,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
private void handleStableOptions() { private void handleStableOptions() {
commandLine.addMixin("Ethstats", ethstatsOptions); commandLine.addMixin("Ethstats", ethstatsOptions);
commandLine.addMixin("Private key file", nodePrivateKeyFileOption); commandLine.addMixin("Private key file", nodePrivateKeyFileOption);
commandLine.addMixin("Logging level", loggingLevelOption);
} }
private void handleUnstableOptions() { private void handleUnstableOptions() {
@ -1519,13 +1515,14 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
public void configureLogging(final boolean announce) { public void configureLogging(final boolean announce) {
// To change the configuration if color was enabled/disabled // To change the configuration if color was enabled/disabled
Configurator.reconfigure(); Log4j2ConfiguratorUtil.reconfigure();
// set log level per CLI flags // set log level per CLI flags
final Level logLevel = loggingLevelOption.getLogLevel();
if (logLevel != null) { if (logLevel != null) {
if (announce) { if (announce) {
System.out.println("Setting logging level to " + logLevel.name()); System.out.println("Setting logging level to " + logLevel.name());
} }
Configurator.setAllLevels("", logLevel); Log4j2ConfiguratorUtil.setAllLevels("", logLevel);
} }
} }
@ -2551,7 +2548,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
try { try {
besuPluginContext.stopPlugins(); besuPluginContext.stopPlugins();
runner.close(); runner.close();
LogManager.shutdown(); Log4j2ConfiguratorUtil.shutdown();
} catch (final Exception e) { } catch (final Exception e) {
logger.error("Failed to stop Besu"); logger.error("Failed to stop Besu");
} }
@ -2817,7 +2814,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
@VisibleForTesting @VisibleForTesting
Level getLogLevel() { Level getLogLevel() {
return logLevel; return loggingLevelOption.getLogLevel();
} }
private class BesuCommandConfigurationService implements BesuConfiguration { private class BesuCommandConfigurationService implements BesuConfiguration {

@ -19,7 +19,6 @@ import org.hyperledger.besu.cli.BesuCommand;
import java.io.IOException; import java.io.IOException;
import java.util.stream.Stream; import java.util.stream.Stream;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.appender.ConsoleAppender; import org.apache.logging.log4j.core.appender.ConsoleAppender;
import org.apache.logging.log4j.core.config.AbstractConfiguration; import org.apache.logging.log4j.core.config.AbstractConfiguration;
@ -27,6 +26,8 @@ import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.ConfigurationSource; import org.apache.logging.log4j.core.config.ConfigurationSource;
import org.apache.logging.log4j.core.config.xml.XmlConfiguration; import org.apache.logging.log4j.core.config.xml.XmlConfiguration;
import org.apache.logging.log4j.core.layout.PatternLayout; import org.apache.logging.log4j.core.layout.PatternLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class XmlExtensionConfiguration extends XmlConfiguration { public class XmlExtensionConfiguration extends XmlConfiguration {
@ -57,11 +58,13 @@ public class XmlExtensionConfiguration extends XmlConfiguration {
createConsoleAppender(); createConsoleAppender();
return refreshed; return refreshed;
} catch (final IOException e) { } catch (final IOException e) {
LogManager.getLogger().error("Failed to reload the Log4j2 Xml configuration file", e); LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)
.error("Failed to reload the Log4j2 Xml configuration file", e);
} }
} }
LogManager.getLogger().warn("Cannot programmatically reconfigure loggers"); LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)
.warn("Cannot programmatically reconfigure loggers");
return refreshedParent; return refreshedParent;
} }

@ -0,0 +1,44 @@
/*
* 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.cli.options.stable;
import org.apache.logging.log4j.Level;
import picocli.CommandLine;
public class LoggingLevelOption {
public static LoggingLevelOption create() {
return new LoggingLevelOption();
}
private Level logLevel;
@CommandLine.Option(
names = {"--logging", "-l"},
paramLabel = "<LOG VERBOSITY LEVEL>",
description = "Logging verbosity levels: OFF, ERROR, WARN, INFO, DEBUG, TRACE, ALL")
public void setLogLevel(final Level logLevel) {
if (Level.FATAL.equals(logLevel)) {
System.out.println("FATAL level is deprecated");
this.logLevel = Level.ERROR;
} else {
this.logLevel = logLevel;
}
}
public Level getLogLevel() {
return logLevel;
}
}

@ -25,7 +25,7 @@ import org.hyperledger.besu.ethereum.p2p.rlpx.connections.netty.TLSConfiguration
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.Logger; import org.slf4j.Logger;
import picocli.CommandLine; import picocli.CommandLine;
import picocli.CommandLine.Option; import picocli.CommandLine.Option;
import picocli.CommandLine.ParameterException; import picocli.CommandLine.ParameterException;

@ -24,7 +24,7 @@ import org.hyperledger.besu.pki.config.PkiKeyStoreConfiguration;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.Logger; import org.slf4j.Logger;
import picocli.CommandLine; import picocli.CommandLine;
import picocli.CommandLine.Option; import picocli.CommandLine.Option;
import picocli.CommandLine.ParameterException; import picocli.CommandLine.ParameterException;

@ -34,8 +34,8 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.function.Function; import java.util.function.Function;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
import picocli.CommandLine; import picocli.CommandLine;
import picocli.CommandLine.Command; import picocli.CommandLine.Command;
import picocli.CommandLine.Mixin; import picocli.CommandLine.Mixin;
@ -51,7 +51,7 @@ import picocli.CommandLine.Spec;
mixinStandardHelpOptions = true, mixinStandardHelpOptions = true,
subcommands = {ExportSubCommand.class, AddressSubCommand.class}) subcommands = {ExportSubCommand.class, AddressSubCommand.class})
public class PublicKeySubCommand implements Runnable { public class PublicKeySubCommand implements Runnable {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(PublicKeySubCommand.class);
public static final String COMMAND_NAME = "public-key"; public static final String COMMAND_NAME = "public-key";

@ -19,18 +19,20 @@ import static org.hyperledger.besu.cli.subcommands.RetestethSubCommand.COMMAND_N
import org.hyperledger.besu.BesuInfo; import org.hyperledger.besu.BesuInfo;
import org.hyperledger.besu.cli.DefaultCommandValues; import org.hyperledger.besu.cli.DefaultCommandValues;
import org.hyperledger.besu.cli.custom.JsonRPCAllowlistHostsProperty; import org.hyperledger.besu.cli.custom.JsonRPCAllowlistHostsProperty;
import org.hyperledger.besu.cli.options.stable.LoggingLevelOption;
import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration;
import org.hyperledger.besu.ethereum.retesteth.RetestethConfiguration; import org.hyperledger.besu.ethereum.retesteth.RetestethConfiguration;
import org.hyperledger.besu.ethereum.retesteth.RetestethService; import org.hyperledger.besu.ethereum.retesteth.RetestethService;
import org.hyperledger.besu.util.Log4j2ConfiguratorUtil;
import java.net.InetAddress; import java.net.InetAddress;
import java.nio.file.Path; import java.nio.file.Path;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.core.config.Configurator;
import picocli.CommandLine.Command; import picocli.CommandLine.Command;
import picocli.CommandLine.Mixin;
import picocli.CommandLine.Option; import picocli.CommandLine.Option;
@Command( @Command(
@ -40,7 +42,7 @@ import picocli.CommandLine.Option;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class RetestethSubCommand implements Runnable { public class RetestethSubCommand implements Runnable {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(RetestethSubCommand.class);
public static final String COMMAND_NAME = "retesteth"; public static final String COMMAND_NAME = "retesteth";
@ -57,12 +59,7 @@ public class RetestethSubCommand implements Runnable {
description = "The path to Besu data directory (default: ${DEFAULT-VALUE})") description = "The path to Besu data directory (default: ${DEFAULT-VALUE})")
private final Path dataPath = DefaultCommandValues.getDefaultBesuDataPath(this); private final Path dataPath = DefaultCommandValues.getDefaultBesuDataPath(this);
@Option( @Mixin private LoggingLevelOption loggingLevelOption;
names = {"--logging", "-l"},
paramLabel = "<LOG VERBOSITY LEVEL>",
description =
"Logging verbosity levels: OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL (default: ${DEFAULT-VALUE})")
private final Level logLevel = LogManager.getRootLogger().getLevel();
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"}) // PicoCLI requires non-final Strings. @SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"}) // PicoCLI requires non-final Strings.
@Option( @Option(
@ -105,9 +102,10 @@ public class RetestethSubCommand implements Runnable {
private void prepareLogging() { private void prepareLogging() {
// set log level per CLI flags // set log level per CLI flags
final Level logLevel = loggingLevelOption.getLogLevel();
if (logLevel != null) { if (logLevel != null) {
System.out.println("Setting logging level to " + logLevel.name()); System.out.println("Setting logging level to " + logLevel.name());
Configurator.setAllLevels("", logLevel); Log4j2ConfiguratorUtil.setAllLevels("", logLevel);
} }
} }
@ -130,7 +128,7 @@ public class RetestethSubCommand implements Runnable {
() -> { () -> {
try { try {
retestethService.close(); retestethService.close();
LogManager.shutdown(); Log4j2ConfiguratorUtil.shutdown();
} catch (final Exception e) { } catch (final Exception e) {
LOG.error("Failed to stop Besu Retesteth"); LOG.error("Failed to stop Besu Retesteth");
} }

@ -55,9 +55,9 @@ import java.util.function.Function;
import java.util.function.Supplier; import java.util.function.Supplier;
import io.vertx.core.Vertx; import io.vertx.core.Vertx;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine; import picocli.CommandLine;
import picocli.CommandLine.Command; import picocli.CommandLine.Command;
import picocli.CommandLine.ExecutionException; import picocli.CommandLine.ExecutionException;
@ -76,7 +76,7 @@ import picocli.CommandLine.Spec;
subcommands = {ImportSubCommand.class, ExportSubCommand.class}) subcommands = {ImportSubCommand.class, ExportSubCommand.class})
public class BlocksSubCommand implements Runnable { public class BlocksSubCommand implements Runnable {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BlocksSubCommand.class);
public static final String COMMAND_NAME = "blocks"; public static final String COMMAND_NAME = "blocks";

@ -51,9 +51,9 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
import com.google.common.base.Suppliers; import com.google.common.base.Suppliers;
import com.google.common.io.Resources; import com.google.common.io.Resources;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Command; import picocli.CommandLine.Command;
import picocli.CommandLine.Option; import picocli.CommandLine.Option;
import picocli.CommandLine.ParentCommand; import picocli.CommandLine.ParentCommand;
@ -63,7 +63,7 @@ import picocli.CommandLine.ParentCommand;
description = "Generates node keypairs and genesis file with RLP encoded extra data.", description = "Generates node keypairs and genesis file with RLP encoded extra data.",
mixinStandardHelpOptions = true) mixinStandardHelpOptions = true)
class GenerateBlockchainConfig implements Runnable { class GenerateBlockchainConfig implements Runnable {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(GenerateBlockchainConfig.class);
private final Supplier<SignatureAlgorithm> SIGNATURE_ALGORITHM = private final Supplier<SignatureAlgorithm> SIGNATURE_ALGORITHM =
Suppliers.memoize(SignatureAlgorithmFactory::getInstance); Suppliers.memoize(SignatureAlgorithmFactory::getInstance);

@ -47,10 +47,10 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.node.ObjectNode;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.bytes.Bytes32;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Command; import picocli.CommandLine.Command;
import picocli.CommandLine.Option; import picocli.CommandLine.Option;
import picocli.CommandLine.ParentCommand; import picocli.CommandLine.ParentCommand;
@ -61,7 +61,7 @@ import picocli.CommandLine.ParentCommand;
mixinStandardHelpOptions = true) mixinStandardHelpOptions = true)
public class RestoreState implements Runnable { public class RestoreState implements Runnable {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(RestoreState.class);
@Option( @Option(
names = "--backup-path", names = "--backup-path",

@ -20,7 +20,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.logging.log4j.Logger; import org.slf4j.Logger;
import picocli.CommandLine; import picocli.CommandLine;
public class CommandLineUtils { public class CommandLineUtils {

@ -41,11 +41,11 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class BesuController implements java.io.Closeable { public class BesuController implements java.io.Closeable {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BesuController.class);
public static final String DATABASE_PATH = "database"; public static final String DATABASE_PATH = "database";
public static final String CACHE_PATH = "caches"; public static final String CACHE_PATH = "caches";

@ -83,11 +83,11 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.OptionalLong; import java.util.OptionalLong;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public abstract class BesuControllerBuilder { public abstract class BesuControllerBuilder {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BesuControllerBuilder.class);
protected GenesisConfigFile genesisConfig; protected GenesisConfigFile genesisConfig;
protected SynchronizerConfiguration syncConfig; protected SynchronizerConfiguration syncConfig;

@ -40,12 +40,12 @@ import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class CliqueBesuControllerBuilder extends BesuControllerBuilder { public class CliqueBesuControllerBuilder extends BesuControllerBuilder {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(CliqueBesuControllerBuilder.class);
private Address localAddress; private Address localAddress;
private EpochManager epochManager; private EpochManager epochManager;

@ -81,12 +81,12 @@ import java.util.function.Supplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.google.common.base.Suppliers; import com.google.common.base.Suppliers;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class IbftBesuControllerBuilder extends BftBesuControllerBuilder { public class IbftBesuControllerBuilder extends BftBesuControllerBuilder {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(IbftBesuControllerBuilder.class);
private BftEventQueue bftEventQueue; private BftEventQueue bftEventQueue;
private BftConfigOptions bftConfig; private BftConfigOptions bftConfig;
private ForksSchedule<BftConfigOptions> forksSchedule; private ForksSchedule<BftConfigOptions> forksSchedule;

@ -47,12 +47,12 @@ import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class IbftLegacyBesuControllerBuilder extends BesuControllerBuilder { public class IbftLegacyBesuControllerBuilder extends BesuControllerBuilder {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(IbftLegacyBesuControllerBuilder.class);
private final BlockInterface blockInterface = new IbftLegacyBlockInterface(); private final BlockInterface blockInterface = new IbftLegacyBlockInterface();
@Override @Override

@ -92,12 +92,12 @@ import java.util.function.Supplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.google.common.base.Suppliers; import com.google.common.base.Suppliers;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class QbftBesuControllerBuilder extends BftBesuControllerBuilder { public class QbftBesuControllerBuilder extends BftBesuControllerBuilder {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(QbftBesuControllerBuilder.class);
private BftEventQueue bftEventQueue; private BftEventQueue bftEventQueue;
private QbftConfigOptions qbftConfig; private QbftConfigOptions qbftConfig;
private ForksSchedule<QbftConfigOptions> qbftForksSchedule; private ForksSchedule<QbftConfigOptions> qbftForksSchedule;

@ -42,12 +42,12 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class BesuPluginContextImpl implements BesuContext, PluginVersionsProvider { public class BesuPluginContextImpl implements BesuContext, PluginVersionsProvider {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BesuPluginContextImpl.class);
private enum Lifecycle { private enum Lifecycle {
UNINITIALIZED, UNINITIALIZED,

@ -16,15 +16,15 @@ package org.hyperledger.besu.services;
import org.hyperledger.besu.plugin.services.PicoCLIOptions; import org.hyperledger.besu.plugin.services.PicoCLIOptions;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
import picocli.CommandLine; import picocli.CommandLine;
import picocli.CommandLine.Model.CommandSpec; import picocli.CommandLine.Model.CommandSpec;
import picocli.CommandLine.Model.OptionSpec; import picocli.CommandLine.Model.OptionSpec;
public class PicoCLIOptionsImpl implements PicoCLIOptions { public class PicoCLIOptionsImpl implements PicoCLIOptions {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(PicoCLIOptionsImpl.class);
private final CommandLine commandLine; private final CommandLine commandLine;

@ -20,11 +20,11 @@ import org.hyperledger.besu.plugin.services.privacy.PrivacyGroupGenesisProvider;
import org.hyperledger.besu.plugin.services.privacy.PrivacyPluginPayloadProvider; import org.hyperledger.besu.plugin.services.privacy.PrivacyPluginPayloadProvider;
import org.hyperledger.besu.plugin.services.privacy.PrivateMarkerTransactionFactory; import org.hyperledger.besu.plugin.services.privacy.PrivateMarkerTransactionFactory;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class PrivacyPluginServiceImpl implements PrivacyPluginService { public class PrivacyPluginServiceImpl implements PrivacyPluginService {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(PrivacyPluginServiceImpl.class);
private PrivacyPluginPayloadProvider privacyPluginPayloadProvider; private PrivacyPluginPayloadProvider privacyPluginPayloadProvider;
private PrivateMarkerTransactionFactory privateMarkerTransactionFactory; private PrivateMarkerTransactionFactory privateMarkerTransactionFactory;

@ -27,12 +27,12 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.apache.logging.log4j.Logger;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
import org.slf4j.Logger;
import picocli.CommandLine; import picocli.CommandLine;
import picocli.CommandLine.Command; import picocli.CommandLine.Command;
import picocli.CommandLine.Option; import picocli.CommandLine.Option;

@ -101,8 +101,6 @@ import java.util.function.Supplier;
import io.vertx.core.Vertx; import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions; import io.vertx.core.VertxOptions;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.apache.tuweni.bytes.Bytes32; import org.apache.tuweni.bytes.Bytes32;
import org.awaitility.Awaitility; import org.awaitility.Awaitility;
@ -115,6 +113,8 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Captor; import org.mockito.Captor;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner; import org.mockito.junit.MockitoJUnitRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine; import picocli.CommandLine;
import picocli.CommandLine.Help.Ansi; import picocli.CommandLine.Help.Ansi;
import picocli.CommandLine.Model.CommandSpec; import picocli.CommandLine.Model.CommandSpec;
@ -123,7 +123,7 @@ import picocli.CommandLine.RunLast;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public abstract class CommandTestAbstract { public abstract class CommandTestAbstract {
private static final Logger TEST_LOGGER = LogManager.getLogger(); private static final Logger TEST_LOGGER = LoggerFactory.getLogger(CommandTestAbstract.class);
protected final ByteArrayOutputStream commandOutput = new ByteArrayOutputStream(); protected final ByteArrayOutputStream commandOutput = new ByteArrayOutputStream();
private final PrintStream outPrintStream = new PrintStream(commandOutput); private final PrintStream outPrintStream = new PrintStream(commandOutput);

@ -457,7 +457,7 @@ subprojects {
duplicateClassesStrategy = DuplicatesStrategy.WARN duplicateClassesStrategy = DuplicatesStrategy.WARN
} }
dependencies { jmh 'org.apache.logging.log4j:log4j-api' } dependencies { jmh 'org.slf4j:slf4j-api' }
} }
} }

@ -28,16 +28,16 @@ jar {
} }
dependencies { dependencies {
api 'org.slf4j:slf4j-api'
implementation project(':datatypes') implementation project(':datatypes')
implementation project(':util') implementation project(':util')
implementation 'com.fasterxml.jackson.core:jackson-databind' implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.google.guava:guava' implementation 'com.google.guava:guava'
implementation 'org.apache.logging.log4j:log4j-api'
implementation 'info.picocli:picocli' implementation 'info.picocli:picocli'
implementation 'org.apache.tuweni:tuweni-bytes' implementation 'org.apache.tuweni:tuweni-bytes'
implementation 'org.apache.tuweni:tuweni-units' implementation 'org.apache.tuweni:tuweni-units'
runtimeOnly 'org.apache.logging.log4j:log4j-core'
testImplementation project(':testutil') testImplementation project(':testutil')

@ -29,16 +29,16 @@ import java.util.function.Supplier;
import com.google.common.base.Suppliers; import com.google.common.base.Suppliers;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Represents the data structure stored in the extraData field of the BlockHeader used when * Represents the data structure stored in the extraData field of the BlockHeader used when
* operating under an Clique consensus mechanism. * operating under an Clique consensus mechanism.
*/ */
public class CliqueExtraData implements ParsedExtraData { public class CliqueExtraData implements ParsedExtraData {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(CliqueExtraData.class);
public static final int EXTRA_VANITY_LENGTH = 32; public static final int EXTRA_VANITY_LENGTH = 32;
private final Bytes vanityData; private final Bytes vanityData;

@ -14,19 +14,18 @@
*/ */
package org.hyperledger.besu.consensus.clique.blockcreation; package org.hyperledger.besu.consensus.clique.blockcreation;
import static org.apache.logging.log4j.LogManager.getLogger;
import org.hyperledger.besu.consensus.clique.CliqueMiningTracker; import org.hyperledger.besu.consensus.clique.CliqueMiningTracker;
import org.hyperledger.besu.ethereum.blockcreation.AbstractMiningCoordinator; import org.hyperledger.besu.ethereum.blockcreation.AbstractMiningCoordinator;
import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.eth.sync.state.SyncState; import org.hyperledger.besu.ethereum.eth.sync.state.SyncState;
import org.apache.logging.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CliqueMiningCoordinator extends AbstractMiningCoordinator<CliqueBlockMiner> { public class CliqueMiningCoordinator extends AbstractMiningCoordinator<CliqueBlockMiner> {
private static final Logger LOG = getLogger(); private static final Logger LOG = LoggerFactory.getLogger(CliqueMiningCoordinator.class);
private final CliqueMiningTracker miningTracker; private final CliqueMiningTracker miningTracker;

@ -23,12 +23,12 @@ import org.hyperledger.besu.ethereum.mainnet.AttachedBlockHeaderValidationRule;
import java.math.BigInteger; import java.math.BigInteger;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class CliqueDifficultyValidationRule implements AttachedBlockHeaderValidationRule { public class CliqueDifficultyValidationRule implements AttachedBlockHeaderValidationRule {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(CliqueDifficultyValidationRule.class);
@Override @Override
public boolean validate( public boolean validate(

@ -26,12 +26,12 @@ import org.hyperledger.besu.ethereum.rlp.RLPException;
import java.util.Collection; import java.util.Collection;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class CliqueExtraDataValidationRule implements AttachedBlockHeaderValidationRule { public class CliqueExtraDataValidationRule implements AttachedBlockHeaderValidationRule {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(CliqueExtraDataValidationRule.class);
private final EpochManager epochManager; private final EpochManager epochManager;

@ -19,12 +19,12 @@ import org.hyperledger.besu.consensus.common.EpochManager;
import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.mainnet.DetachedBlockHeaderValidationRule; import org.hyperledger.besu.ethereum.mainnet.DetachedBlockHeaderValidationRule;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class CoinbaseHeaderValidationRule implements DetachedBlockHeaderValidationRule { public class CoinbaseHeaderValidationRule implements DetachedBlockHeaderValidationRule {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(CoinbaseHeaderValidationRule.class);
private final EpochManager epochManager; private final EpochManager epochManager;

@ -20,12 +20,12 @@ import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.mainnet.AttachedBlockHeaderValidationRule; import org.hyperledger.besu.ethereum.mainnet.AttachedBlockHeaderValidationRule;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class SignerRateLimitValidationRule implements AttachedBlockHeaderValidationRule { public class SignerRateLimitValidationRule implements AttachedBlockHeaderValidationRule {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(SignerRateLimitValidationRule.class);
@Override @Override
public boolean validate( public boolean validate(

@ -18,12 +18,12 @@ import org.hyperledger.besu.consensus.clique.CliqueBlockInterface;
import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.mainnet.DetachedBlockHeaderValidationRule; import org.hyperledger.besu.ethereum.mainnet.DetachedBlockHeaderValidationRule;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class VoteValidationRule implements DetachedBlockHeaderValidationRule { public class VoteValidationRule implements DetachedBlockHeaderValidationRule {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(VoteValidationRule.class);
/** /**
* Responsible for ensuring the nonce is either auth or drop. * Responsible for ensuring the nonce is either auth or drop.

@ -14,8 +14,6 @@
*/ */
package org.hyperledger.besu.consensus.common; package org.hyperledger.besu.consensus.common;
import static org.apache.logging.log4j.LogManager.getLogger;
import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator; import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator;
@ -30,12 +28,13 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MigratingMiningCoordinator implements MiningCoordinator, BlockAddedObserver { public class MigratingMiningCoordinator implements MiningCoordinator, BlockAddedObserver {
private static final Logger LOG = getLogger(); private static final Logger LOG = LoggerFactory.getLogger(MigratingMiningCoordinator.class);
private final ForksSchedule<MiningCoordinator> miningCoordinatorSchedule; private final ForksSchedule<MiningCoordinator> miningCoordinatorSchedule;
private final Blockchain blockchain; private final Blockchain blockchain;

@ -21,14 +21,14 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** Threadsafe queue that lets parts of the system inform the Bft infrastructure about events */ /** Threadsafe queue that lets parts of the system inform the Bft infrastructure about events */
public class BftEventQueue { public class BftEventQueue {
private final BlockingQueue<BftEvent> queue = new LinkedBlockingQueue<>(); private final BlockingQueue<BftEvent> queue = new LinkedBlockingQueue<>();
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BftEventQueue.class);
private final int messageQueueLimit; private final int messageQueueLimit;
public BftEventQueue(final int messageQueueLimit) { public BftEventQueue(final int messageQueueLimit) {

@ -25,8 +25,8 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class BftExecutors { public class BftExecutors {
@ -36,7 +36,7 @@ public class BftExecutors {
STOPPED STOPPED
} }
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BftExecutors.class);
private final Duration shutdownTimeout = Duration.ofSeconds(30); private final Duration shutdownTimeout = Duration.ofSeconds(30);
private final MetricsSystem metricsSystem; private final MetricsSystem metricsSystem;

@ -16,9 +16,9 @@ package org.hyperledger.besu.consensus.common.bft;
import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class BftExtraDataCodec { public abstract class BftExtraDataCodec {
@ -28,7 +28,7 @@ public abstract class BftExtraDataCodec {
EXCLUDE_COMMIT_SEALS_AND_ROUND_NUMBER EXCLUDE_COMMIT_SEALS_AND_ROUND_NUMBER
} }
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BftExtraDataCodec.class);
public static int EXTRA_VANITY_LENGTH = 32; public static int EXTRA_VANITY_LENGTH = 32;

@ -20,13 +20,13 @@ import java.util.Optional;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** Execution context for draining queued bft events and applying them to a maintained state */ /** Execution context for draining queued bft events and applying them to a maintained state */
public class BftProcessor implements Runnable { public class BftProcessor implements Runnable {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BftProcessor.class);
private final BftEventQueue incomingQueue; private final BftEventQueue incomingQueue;
private volatile boolean shutdown = false; private volatile boolean shutdown = false;

@ -14,17 +14,16 @@
*/ */
package org.hyperledger.besu.consensus.common.bft; package org.hyperledger.besu.consensus.common.bft;
import static org.apache.logging.log4j.LogManager.getLogger;
import org.hyperledger.besu.ethereum.eth.manager.EthPeer; import org.hyperledger.besu.ethereum.eth.manager.EthPeer;
import org.hyperledger.besu.ethereum.eth.manager.EthPeers; import org.hyperledger.besu.ethereum.eth.manager.EthPeers;
import org.hyperledger.besu.ethereum.p2p.rlpx.connections.PeerConnection; import org.hyperledger.besu.ethereum.p2p.rlpx.connections.PeerConnection;
import org.apache.logging.log4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class EthSynchronizerUpdater implements SynchronizerUpdater { public class EthSynchronizerUpdater implements SynchronizerUpdater {
private static final Logger LOG = getLogger(); private static final Logger LOG = LoggerFactory.getLogger(EthSynchronizerUpdater.class);
private final EthPeers ethPeers; private final EthPeers ethPeers;
public EthSynchronizerUpdater(final EthPeers ethPeers) { public EthSynchronizerUpdater(final EthPeers ethPeers) {

@ -21,12 +21,12 @@ import org.hyperledger.besu.consensus.common.bft.events.NewChainHead;
import org.hyperledger.besu.consensus.common.bft.events.RoundExpiry; import org.hyperledger.besu.consensus.common.bft.events.RoundExpiry;
import org.hyperledger.besu.consensus.common.bft.statemachine.BftEventHandler; import org.hyperledger.besu.consensus.common.bft.statemachine.BftEventHandler;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class EventMultiplexer { public class EventMultiplexer {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(EventMultiplexer.class);
private final BftEventHandler eventHandler; private final BftEventHandler eventHandler;

@ -14,8 +14,6 @@
*/ */
package org.hyperledger.besu.consensus.common.bft.blockcreation; package org.hyperledger.besu.consensus.common.bft.blockcreation;
import static org.apache.logging.log4j.LogManager.getLogger;
import org.hyperledger.besu.consensus.common.bft.BftEventQueue; import org.hyperledger.besu.consensus.common.bft.BftEventQueue;
import org.hyperledger.besu.consensus.common.bft.BftExecutors; import org.hyperledger.besu.consensus.common.bft.BftExecutors;
import org.hyperledger.besu.consensus.common.bft.BftProcessor; import org.hyperledger.besu.consensus.common.bft.BftProcessor;
@ -35,8 +33,9 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BftMiningCoordinator implements MiningCoordinator, BlockAddedObserver { public class BftMiningCoordinator implements MiningCoordinator, BlockAddedObserver {
@ -46,7 +45,7 @@ public class BftMiningCoordinator implements MiningCoordinator, BlockAddedObserv
STOPPED STOPPED
} }
private static final Logger LOG = getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BftMiningCoordinator.class);
private final BftEventHandler eventHandler; private final BftEventHandler eventHandler;
private final BftProcessor bftProcessor; private final BftProcessor bftProcessor;

@ -30,8 +30,8 @@ import java.util.NavigableSet;
import java.util.Optional; import java.util.Optional;
import java.util.TreeSet; import java.util.TreeSet;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* Responsible for determining which member of the validator pool should propose the next block * Responsible for determining which member of the validator pool should propose the next block
@ -44,7 +44,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class ProposerSelector { public class ProposerSelector {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(ProposerSelector.class);
private final Blockchain blockchain; private final Blockchain blockchain;

@ -22,8 +22,8 @@ import org.hyperledger.besu.ethereum.mainnet.AttachedBlockHeaderValidationRule;
import java.util.Collection; import java.util.Collection;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* Ensures that the coinbase (which corresponds to the block proposer) is included in the list of * Ensures that the coinbase (which corresponds to the block proposer) is included in the list of
@ -31,7 +31,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class BftCoinbaseValidationRule implements AttachedBlockHeaderValidationRule { public class BftCoinbaseValidationRule implements AttachedBlockHeaderValidationRule {
private static final Logger LOGGER = LogManager.getLogger(BftCoinbaseValidationRule.class); private static final Logger LOGGER = LoggerFactory.getLogger(BftCoinbaseValidationRule.class);
@Override @Override
public boolean validate( public boolean validate(

@ -27,8 +27,8 @@ import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* Ensures the commit seals in the block header were created by known validators (as determined by * Ensures the commit seals in the block header were created by known validators (as determined by
@ -38,7 +38,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class BftCommitSealsValidationRule implements AttachedBlockHeaderValidationRule { public class BftCommitSealsValidationRule implements AttachedBlockHeaderValidationRule {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LoggerFactory.getLogger(BftCommitSealsValidationRule.class);
@Override @Override
public boolean validate( public boolean validate(

@ -27,8 +27,8 @@ import java.util.NavigableSet;
import java.util.TreeSet; import java.util.TreeSet;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* Ensures the Validators listed in the block header match that tracked in memory (which was in-turn * Ensures the Validators listed in the block header match that tracked in memory (which was in-turn
@ -36,7 +36,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class BftValidatorsValidationRule implements AttachedBlockHeaderValidationRule { public class BftValidatorsValidationRule implements AttachedBlockHeaderValidationRule {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LoggerFactory.getLogger(BftValidatorsValidationRule.class);
@Override @Override
public boolean validate( public boolean validate(

@ -21,12 +21,12 @@ import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.mainnet.AttachedBlockHeaderValidationRule; import org.hyperledger.besu.ethereum.mainnet.AttachedBlockHeaderValidationRule;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class BftVanityDataValidationRule implements AttachedBlockHeaderValidationRule { public class BftVanityDataValidationRule implements AttachedBlockHeaderValidationRule {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BftVanityDataValidationRule.class);
@Override @Override
public boolean validate( public boolean validate(

@ -28,8 +28,8 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* Responsible for tracking the network peers which have a connection to this node, then * Responsible for tracking the network peers which have a connection to this node, then
@ -37,7 +37,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class ValidatorPeers implements ValidatorMulticaster, PeerConnectionTracker { public class ValidatorPeers implements ValidatorMulticaster, PeerConnectionTracker {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(ValidatorPeers.class);
// It's possible for multiple connections between peers to exist for brief periods, so map each // It's possible for multiple connections between peers to exist for brief periods, so map each
// address to a set of connections // address to a set of connections

@ -29,11 +29,11 @@ import org.hyperledger.besu.ethereum.p2p.rlpx.wire.messages.DisconnectMessage.Di
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class BftProtocolManager implements ProtocolManager { public class BftProtocolManager implements ProtocolManager {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BftProtocolManager.class);
private final BftEventQueue bftEventQueue; private final BftEventQueue bftEventQueue;
private final PeerConnectionTracker peers; private final PeerConnectionTracker peers;

@ -32,12 +32,12 @@ import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer; import java.util.function.Consumer;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public abstract class BaseBftController implements BftEventHandler { public abstract class BaseBftController implements BftEventHandler {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(BaseBftController.class);
private final Blockchain blockchain; private final Blockchain blockchain;
private final BftFinalState bftFinalState; private final BftFinalState bftFinalState;
private final FutureMessageBuffer futureMessageBuffer; private final FutureMessageBuffer futureMessageBuffer;

@ -24,8 +24,8 @@ import org.hyperledger.besu.ethereum.core.BlockHeader;
import java.util.Collection; import java.util.Collection;
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* Provides the logic to extract vote tally state from the blockchain and update it as blocks are * Provides the logic to extract vote tally state from the blockchain and update it as blocks are
@ -33,7 +33,7 @@ import org.apache.logging.log4j.Logger;
*/ */
class VoteTallyUpdater { class VoteTallyUpdater {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(VoteTallyUpdater.class);
private final EpochManager epochManager; private final EpochManager epochManager;
private final BlockInterface blockInterface; private final BlockInterface blockInterface;

@ -24,11 +24,11 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class IbftDiscardValidatorVote implements JsonRpcMethod { public class IbftDiscardValidatorVote implements JsonRpcMethod {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(IbftDiscardValidatorVote.class);
private final ValidatorProvider validatorProvider; private final ValidatorProvider validatorProvider;
public IbftDiscardValidatorVote(final ValidatorProvider validatorProvider) { public IbftDiscardValidatorVote(final ValidatorProvider validatorProvider) {

@ -27,11 +27,11 @@ import org.hyperledger.besu.ethereum.core.BlockHeader;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class IbftGetValidatorsByBlockHash implements JsonRpcMethod { public class IbftGetValidatorsByBlockHash implements JsonRpcMethod {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(IbftGetValidatorsByBlockHash.class);
private final Blockchain blockchain; private final Blockchain blockchain;
private final BlockInterface blockInterface; private final BlockInterface blockInterface;

@ -26,12 +26,12 @@ import org.hyperledger.besu.ethereum.core.BlockHeader;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class IbftGetValidatorsByBlockNumber extends AbstractBlockParameterMethod public class IbftGetValidatorsByBlockNumber extends AbstractBlockParameterMethod
implements JsonRpcMethod { implements JsonRpcMethod {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(IbftGetValidatorsByBlockNumber.class);
private final BlockInterface blockInterface; private final BlockInterface blockInterface;

@ -25,11 +25,11 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class IbftProposeValidatorVote implements JsonRpcMethod { public class IbftProposeValidatorVote implements JsonRpcMethod {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(IbftProposeValidatorVote.class);
private final ValidatorProvider validatorProvider; private final ValidatorProvider validatorProvider;
public IbftProposeValidatorVote(final ValidatorProvider validatorProvider) { public IbftProposeValidatorVote(final ValidatorProvider validatorProvider) {

@ -34,12 +34,12 @@ import org.hyperledger.besu.plugin.services.securitymodule.SecurityModuleExcepti
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class IbftMessageTransmitter { public class IbftMessageTransmitter {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(IbftMessageTransmitter.class);
private final MessageFactory messageFactory; private final MessageFactory messageFactory;
private final ValidatorMulticaster multicaster; private final ValidatorMulticaster multicaster;

@ -45,8 +45,8 @@ import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* Responsible for starting/clearing Consensus rounds at a given block height. One of these is * Responsible for starting/clearing Consensus rounds at a given block height. One of these is
@ -56,7 +56,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class IbftBlockHeightManager implements BaseIbftBlockHeightManager { public class IbftBlockHeightManager implements BaseIbftBlockHeightManager {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(IbftBlockHeightManager.class);
private final IbftRoundFactory roundFactory; private final IbftRoundFactory roundFactory;
private final RoundChangeManager roundChangeManager; private final RoundChangeManager roundChangeManager;

@ -44,13 +44,12 @@ import org.hyperledger.besu.util.Subscribers;
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.Level; import org.slf4j.Logger;
import org.apache.logging.log4j.LogManager; import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.Logger;
public class IbftRound { public class IbftRound {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(IbftRound.class);
private final Subscribers<MinedBlockObserver> observers; private final Subscribers<MinedBlockObserver> observers;
private final RoundState roundState; private final RoundState roundState;
@ -249,11 +248,17 @@ public class IbftRound {
final long blockNumber = blockToImport.getHeader().getNumber(); final long blockNumber = blockToImport.getHeader().getNumber();
final BftExtraData extraData = bftExtraDataCodec.decode(blockToImport.getHeader()); final BftExtraData extraData = bftExtraDataCodec.decode(blockToImport.getHeader());
LOG.log( if (getRoundIdentifier().getRoundNumber() > 0) {
getRoundIdentifier().getRoundNumber() > 0 ? Level.INFO : Level.DEBUG, LOG.info(
"Importing block to chain. round={}, hash={}", "Importing block to chain. round={}, hash={}",
getRoundIdentifier(), getRoundIdentifier(),
blockToImport.getHash()); blockToImport.getHash());
} else {
LOG.debug(
"Importing block to chain. round={}, hash={}",
getRoundIdentifier(),
blockToImport.getHash());
}
LOG.trace("Importing block with extraData={}", extraData); LOG.trace("Importing block with extraData={}", extraData);
final boolean result = final boolean result =
blockImporter.importBlock(protocolContext, blockToImport, HeaderValidationMode.FULL); blockImporter.importBlock(protocolContext, blockToImport, HeaderValidationMode.FULL);

@ -25,8 +25,8 @@ import java.util.Optional;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* Responsible for handling all RoundChange messages received for a given block height * Responsible for handling all RoundChange messages received for a given block height
@ -72,7 +72,7 @@ public class RoundChangeManager {
} }
} }
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(RoundChangeManager.class);
@VisibleForTesting @VisibleForTesting
final Map<ConsensusRoundIdentifier, RoundChangeStatus> roundChangeCache = Maps.newHashMap(); final Map<ConsensusRoundIdentifier, RoundChangeStatus> roundChangeCache = Maps.newHashMap();

@ -29,12 +29,12 @@ import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
// Data items used to define how a round will operate // Data items used to define how a round will operate
public class RoundState { public class RoundState {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(RoundState.class);
private final ConsensusRoundIdentifier roundIdentifier; private final ConsensusRoundIdentifier roundIdentifier;
private final MessageValidator validator; private final MessageValidator validator;

@ -17,15 +17,16 @@ package org.hyperledger.besu.consensus.ibft.validation;
import org.hyperledger.besu.consensus.ibft.messagewrappers.Proposal; import org.hyperledger.besu.consensus.ibft.messagewrappers.Proposal;
import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/* One of these will be created by the IbftBlockHeightManager and will exist for the life of the /* One of these will be created by the IbftBlockHeightManager and will exist for the life of the
chainheight, and used to ensure supplied Proposals are suitable for starting a new round. chainheight, and used to ensure supplied Proposals are suitable for starting a new round.
*/ */
public class FutureRoundProposalMessageValidator { public class FutureRoundProposalMessageValidator {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG =
LoggerFactory.getLogger(FutureRoundProposalMessageValidator.class);
private final MessageValidatorFactory messageValidatorFactory; private final MessageValidatorFactory messageValidatorFactory;
private final long chainHeight; private final long chainHeight;

@ -29,12 +29,12 @@ import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode;
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class MessageValidator { public class MessageValidator {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(MessageValidator.class);
private final SignedDataValidator signedDataValidator; private final SignedDataValidator signedDataValidator;
private final ProposalBlockConsistencyValidator proposalConsistencyValidator; private final ProposalBlockConsistencyValidator proposalConsistencyValidator;

@ -21,12 +21,13 @@ import org.hyperledger.besu.consensus.common.bft.payload.SignedData;
import org.hyperledger.besu.consensus.ibft.payload.ProposalPayload; import org.hyperledger.besu.consensus.ibft.payload.ProposalPayload;
import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.Block;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class ProposalBlockConsistencyValidator { public class ProposalBlockConsistencyValidator {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG =
LoggerFactory.getLogger(ProposalBlockConsistencyValidator.class);
public boolean validateProposalMatchesBlock( public boolean validateProposalMatchesBlock(
final SignedData<ProposalPayload> signedPayload, final SignedData<ProposalPayload> signedPayload,

@ -30,12 +30,12 @@ import org.hyperledger.besu.ethereum.core.Block;
import java.util.Collection; import java.util.Collection;
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class RoundChangeCertificateValidator { public class RoundChangeCertificateValidator {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(RoundChangeCertificateValidator.class);
private final Collection<Address> validators; private final Collection<Address> validators;
private final MessageValidatorForHeightFactory messageValidatorFactory; private final MessageValidatorForHeightFactory messageValidatorFactory;

@ -17,12 +17,12 @@ package org.hyperledger.besu.consensus.ibft.validation;
import org.hyperledger.besu.consensus.common.bft.BftBlockInterface; import org.hyperledger.besu.consensus.common.bft.BftBlockInterface;
import org.hyperledger.besu.consensus.ibft.messagewrappers.RoundChange; import org.hyperledger.besu.consensus.ibft.messagewrappers.RoundChange;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class RoundChangeMessageValidator { public class RoundChangeMessageValidator {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(RoundChangeMessageValidator.class);
private final RoundChangePayloadValidator roundChangePayloadValidator; private final RoundChangePayloadValidator roundChangePayloadValidator;
private final ProposalBlockConsistencyValidator proposalBlockConsistencyValidator; private final ProposalBlockConsistencyValidator proposalBlockConsistencyValidator;

@ -24,12 +24,12 @@ import org.hyperledger.besu.datatypes.Address;
import java.util.Collection; import java.util.Collection;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class RoundChangePayloadValidator { public class RoundChangePayloadValidator {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(RoundChangePayloadValidator.class);
private final MessageValidatorForHeightFactory messageValidatorFactory; private final MessageValidatorForHeightFactory messageValidatorFactory;
private final Collection<Address> validators; private final Collection<Address> validators;

@ -27,12 +27,12 @@ import org.hyperledger.besu.ethereum.core.Util;
import java.util.Collection; import java.util.Collection;
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class SignedDataValidator { public class SignedDataValidator {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(SignedDataValidator.class);
private final Collection<Address> validators; private final Collection<Address> validators;
private final Address expectedProposer; private final Address expectedProposer;

@ -31,16 +31,16 @@ import java.util.Collection;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
import com.google.common.base.Suppliers; import com.google.common.base.Suppliers;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Represents the data structure stored in the extraData field of the BlockHeader used when * Represents the data structure stored in the extraData field of the BlockHeader used when
* operating under an IBFT consensus mechanism. * operating under an IBFT consensus mechanism.
*/ */
public class IbftExtraData implements ParsedExtraData { public class IbftExtraData implements ParsedExtraData {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(IbftExtraData.class);
public static final int EXTRA_VANITY_LENGTH = 32; public static final int EXTRA_VANITY_LENGTH = 32;
private static final Supplier<SignatureAlgorithm> SIGNATURE_ALGORITHM = private static final Supplier<SignatureAlgorithm> SIGNATURE_ALGORITHM =

@ -31,8 +31,8 @@ import java.util.NavigableSet;
import java.util.TreeSet; import java.util.TreeSet;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* Ensures the byte content of the extraData field can be deserialised into an appropriate * Ensures the byte content of the extraData field can be deserialised into an appropriate
@ -41,7 +41,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidationRule { public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidationRule {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(IbftExtraDataValidationRule.class);
private final boolean validateCommitSeals; private final boolean validateCommitSeals;
private final long ceil2nBy3Block; private final long ceil2nBy3Block;

@ -18,12 +18,12 @@ import org.hyperledger.besu.consensus.ibftlegacy.IbftLegacyBlockInterface;
import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.mainnet.DetachedBlockHeaderValidationRule; import org.hyperledger.besu.ethereum.mainnet.DetachedBlockHeaderValidationRule;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class VoteValidationRule implements DetachedBlockHeaderValidationRule { public class VoteValidationRule implements DetachedBlockHeaderValidationRule {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(VoteValidationRule.class);
/** /**
* Responsible for ensuring the nonce is either auth or drop. * Responsible for ensuring the nonce is either auth or drop.

@ -34,12 +34,12 @@ import org.hyperledger.besu.pki.cms.CmsCreator;
import java.util.List; import java.util.List;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PkiQbftBlockCreator implements BlockCreator { public class PkiQbftBlockCreator implements BlockCreator {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(PkiQbftBlockCreator.class);
private final BlockCreator blockCreator; private final BlockCreator blockCreator;
private final PkiQbftExtraDataCodec pkiQbftExtraDataCodec; private final PkiQbftExtraDataCodec pkiQbftExtraDataCodec;

@ -22,8 +22,8 @@ import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.mainnet.AttachedBlockHeaderValidationRule; import org.hyperledger.besu.ethereum.mainnet.AttachedBlockHeaderValidationRule;
import org.hyperledger.besu.ethereum.rlp.RLPException; import org.hyperledger.besu.ethereum.rlp.RLPException;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
/** /**
* Ensures the Validators listed in the block header match that tracked in memory (which was in-turn * Ensures the Validators listed in the block header match that tracked in memory (which was in-turn
@ -31,7 +31,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class QbftValidatorsValidationRule implements AttachedBlockHeaderValidationRule { public class QbftValidatorsValidationRule implements AttachedBlockHeaderValidationRule {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LoggerFactory.getLogger(QbftValidatorsValidationRule.class);
private final boolean extraDataValidatorsAndVoteMustBeEmpty; private final boolean extraDataValidatorsAndVoteMustBeEmpty;
private final BftValidatorsValidationRule bftValidatorsValidationRule = private final BftValidatorsValidationRule bftValidatorsValidationRule =
new BftValidatorsValidationRule(); new BftValidatorsValidationRule();

@ -24,11 +24,11 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorR
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class QbftDiscardValidatorVote implements JsonRpcMethod { public class QbftDiscardValidatorVote implements JsonRpcMethod {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(QbftDiscardValidatorVote.class);
private final ValidatorProvider validatorProvider; private final ValidatorProvider validatorProvider;
public QbftDiscardValidatorVote(final ValidatorProvider validatorProvider) { public QbftDiscardValidatorVote(final ValidatorProvider validatorProvider) {

@ -28,11 +28,11 @@ import org.hyperledger.besu.ethereum.core.BlockHeader;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class QbftGetValidatorsByBlockHash implements JsonRpcMethod { public class QbftGetValidatorsByBlockHash implements JsonRpcMethod {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(QbftGetValidatorsByBlockHash.class);
private final Blockchain blockchain; private final Blockchain blockchain;
private final ValidatorProvider validatorProvider; private final ValidatorProvider validatorProvider;

@ -27,12 +27,12 @@ import org.hyperledger.besu.ethereum.core.BlockHeader;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class QbftGetValidatorsByBlockNumber extends AbstractBlockParameterMethod public class QbftGetValidatorsByBlockNumber extends AbstractBlockParameterMethod
implements JsonRpcMethod { implements JsonRpcMethod {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(QbftGetValidatorsByBlockNumber.class);
private final ValidatorProvider validatorProvider; private final ValidatorProvider validatorProvider;
public QbftGetValidatorsByBlockNumber( public QbftGetValidatorsByBlockNumber(

@ -25,11 +25,11 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorR
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class QbftProposeValidatorVote implements JsonRpcMethod { public class QbftProposeValidatorVote implements JsonRpcMethod {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(QbftProposeValidatorVote.class);
private final ValidatorProvider validatorProvider; private final ValidatorProvider validatorProvider;
public QbftProposeValidatorVote(final ValidatorProvider validatorProvider) { public QbftProposeValidatorVote(final ValidatorProvider validatorProvider) {

@ -37,12 +37,12 @@ import org.hyperledger.besu.plugin.services.securitymodule.SecurityModuleExcepti
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class QbftMessageTransmitter { public class QbftMessageTransmitter {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG = LoggerFactory.getLogger(QbftMessageTransmitter.class);
private final MessageFactory messageFactory; private final MessageFactory messageFactory;
private final ValidatorMulticaster multicaster; private final ValidatorMulticaster multicaster;

@ -21,12 +21,13 @@ import org.hyperledger.besu.pki.config.PkiKeyStoreConfiguration;
import org.hyperledger.besu.pki.keystore.KeyStoreWrapper; import org.hyperledger.besu.pki.keystore.KeyStoreWrapper;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import org.apache.logging.log4j.LogManager; import org.slf4j.Logger;
import org.apache.logging.log4j.Logger; import org.slf4j.LoggerFactory;
public class PkiBlockCreationConfigurationProvider { public class PkiBlockCreationConfigurationProvider {
private static final Logger LOG = LogManager.getLogger(); private static final Logger LOG =
LoggerFactory.getLogger(PkiBlockCreationConfigurationProvider.class);
private final KeyStoreWrapperProvider keyStoreWrapperProvider; private final KeyStoreWrapperProvider keyStoreWrapperProvider;
@ -51,9 +52,7 @@ public class PkiBlockCreationConfigurationProvider {
null); null);
LOG.info("Loaded PKI Block Creation KeyStore {}", pkiKeyStoreConfiguration.getKeyStorePath()); LOG.info("Loaded PKI Block Creation KeyStore {}", pkiKeyStoreConfiguration.getKeyStorePath());
} catch (Exception e) { } catch (Exception e) {
final String message = "Error loading PKI Block Creation KeyStore"; throw new IllegalStateException("Error loading PKI Block Creation KeyStore", e);
LOG.error(message, e);
throw new RuntimeException(message, e);
} }
KeyStoreWrapper trustStore; KeyStoreWrapper trustStore;
@ -67,9 +66,7 @@ public class PkiBlockCreationConfigurationProvider {
LOG.info( LOG.info(
"Loaded PKI Block Creation TrustStore {}", pkiKeyStoreConfiguration.getTrustStorePath()); "Loaded PKI Block Creation TrustStore {}", pkiKeyStoreConfiguration.getTrustStorePath());
} catch (Exception e) { } catch (Exception e) {
final String message = "Error loading PKI Block Creation TrustStore"; throw new IllegalStateException("Error loading PKI Block Creation TrustStore", e);
LOG.error(message, e);
throw new RuntimeException(message, e);
} }
return new PkiBlockCreationConfiguration( return new PkiBlockCreationConfiguration(

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save