From b0af12d5dce7353667358b10661849c1e8a40881 Mon Sep 17 00:00:00 2001 From: Nishant Das Date: Sat, 18 Apr 2020 14:23:45 +0800 Subject: [PATCH] Add Geth Logging (#5474) * add new logging * Update beacon-chain/main.go * Merge refs/heads/master into gethLogging * Merge refs/heads/master into gethLogging * Merge refs/heads/master into gethLogging * Merge refs/heads/master into gethLogging * fix image * Merge refs/heads/master into gethLogging --- beacon-chain/BUILD.bazel | 2 ++ beacon-chain/main.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/beacon-chain/BUILD.bazel b/beacon-chain/BUILD.bazel index 0cba3ee44..d877862fd 100644 --- a/beacon-chain/BUILD.bazel +++ b/beacon-chain/BUILD.bazel @@ -20,6 +20,7 @@ go_library( "//shared/featureconfig:go_default_library", "//shared/logutil:go_default_library", "//shared/version:go_default_library", + "@com_github_ethereum_go_ethereum//log:go_default_library", "@com_github_ipfs_go_log//:go_default_library", "@com_github_joonix_log//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", @@ -57,6 +58,7 @@ go_image( "//shared/featureconfig:go_default_library", "//shared/logutil:go_default_library", "//shared/version:go_default_library", + "@com_github_ethereum_go_ethereum//log:go_default_library", "@com_github_ipfs_go_log//:go_default_library", "@com_github_joonix_log//:go_default_library", "@com_github_sirupsen_logrus//:go_default_library", diff --git a/beacon-chain/main.go b/beacon-chain/main.go index b492509f1..cf6f6a4b4 100644 --- a/beacon-chain/main.go +++ b/beacon-chain/main.go @@ -7,6 +7,7 @@ import ( "runtime" runtimeDebug "runtime/debug" + gethlog "github.com/ethereum/go-ethereum/log" golog "github.com/ipfs/go-log" joonix "github.com/joonix/log" "github.com/prysmaticlabs/prysm/beacon-chain/flags" @@ -167,7 +168,12 @@ func startNode(ctx *cli.Context) error { } logrus.SetLevel(level) if level == logrus.TraceLevel { + // libp2p specific logging. golog.SetAllLoggers(gologging.DEBUG) + // Geth specific logging. + glogger := gethlog.NewGlogHandler(gethlog.StreamHandler(os.Stderr, gethlog.TerminalFormat(true))) + glogger.Verbosity(gethlog.LvlTrace) + gethlog.Root().SetHandler(glogger) } beacon, err := node.NewBeaconNode(ctx)