Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Capture all logs and errors in the Pantheon log output (#1437)
Browse files Browse the repository at this point in the history
* Add slf4j to log4j bindings as a runtime dependency so any libraries that log to slf4j have their logs output to Pantheon's logs properly.

* Set a default exception handler to ensure uncaught exceptions wind up in the Pantheon logs.
  • Loading branch information
ajsutton committed May 13, 2019
1 parent fc6fdac commit a453610
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions pantheon/build.gradle
Expand Up @@ -54,6 +54,7 @@ dependencies {
implementation 'org.springframework.security:spring-security-crypto'

runtime 'org.apache.logging.log4j:log4j-core'
runtime 'org.apache.logging.log4j:log4j-slf4j-impl'

testImplementation project(':testutil')
testImplementation project(path: ':ethereum:core', configuration: 'testSupportArtifacts')
Expand Down
8 changes: 6 additions & 2 deletions pantheon/src/main/java/tech/pegasys/pantheon/Pantheon.java
Expand Up @@ -21,17 +21,21 @@
import tech.pegasys.pantheon.services.kvstore.RocksDbConfiguration;
import tech.pegasys.pantheon.util.BlockImporter;

import org.apache.logging.log4j.Logger;
import picocli.CommandLine.RunLast;

public final class Pantheon {
private static final int SUCCESS_EXIT_CODE = 0;
private static final int ERROR_EXIT_CODE = 1;

public static void main(final String... args) {

final Logger logger = getLogger();
Thread.setDefaultUncaughtExceptionHandler(
(thread, error) ->
logger.error("Uncaught exception in thread \"" + thread.getName() + "\"", error));
final PantheonCommand pantheonCommand =
new PantheonCommand(
getLogger(),
logger,
new BlockImporter(),
new RunnerBuilder(),
new PantheonController.Builder(),
Expand Down

0 comments on commit a453610

Please sign in to comment.