mirror of https://github.com/hyperledger/besu
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
parent
e7ccb33061
commit
ed1329cf84
@ -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; |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue