From 848fbb939db49ffd0f8a366ae5722646d326ec9d Mon Sep 17 00:00:00 2001 From: erhan yasar Date: Sat, 11 Apr 2026 17:20:37 +0300 Subject: [PATCH] fix: standardise LOG_LEVEL across all execution-client entrypoints All three execution-client entrypoints handled log verbosity differently, making it hard to set consistent log levels across client types via a single environment variable. Problems fixed: 1. reth-entrypoint: an unrecognised LOG_LEVEL silently fell through to the default (info/vvv) with only an echo warning. Operators mistyping 'INFO' or 'WARNING' would get no indication the value was ignored. Changed the wildcard arm to print to stderr and exit 1. 2. geth-entrypoint: only GETH_VERBOSITY (numeric, 0-5) was supported. Added LOG_LEVEL pre-processing that maps error/warn/info/debug/trace to the corresponding numeric verbosity. GETH_VERBOSITY is used as fallback when LOG_LEVEL is not set, preserving backwards compatibility. 3. nethermind-entrypoint: same issue as geth. Added LOG_LEVEL mapping block translating to Nethermind's Error/Warn/Info/Debug/Trace strings. After this change operators can set LOG_LEVEL=debug once in their .env file and have it apply uniformly across all three clients, matching the behaviour that already exists for OP_NODE_LOG_LEVEL on the consensus side. All existing GETH_VERBOSITY / NETHERMIND_LOG_LEVEL variables continue to work unchanged. --- geth/geth-entrypoint | 18 +++++++++++++++++- nethermind/nethermind-entrypoint | 18 +++++++++++++++++- reth/reth-entrypoint | 4 ++-- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/geth/geth-entrypoint b/geth/geth-entrypoint index b598cb3f..f7724e55 100755 --- a/geth/geth-entrypoint +++ b/geth/geth-entrypoint @@ -1,7 +1,23 @@ #!/bin/bash set -eu -VERBOSITY=${GETH_VERBOSITY:-3} +# GETH_VERBOSITY sets the numeric log level (0=crit, 1=error, 2=warn, 3=info, 4=debug, 5=trace) +# LOG_LEVEL accepts human-readable aliases and takes precedence when set +if [[ -n "${LOG_LEVEL:-}" ]]; then + case "$LOG_LEVEL" in + "error") VERBOSITY=1 ;; + "warn") VERBOSITY=2 ;; + "info") VERBOSITY=3 ;; + "debug") VERBOSITY=4 ;; + "trace") VERBOSITY=5 ;; + *) + echo "Invalid LOG_LEVEL: $LOG_LEVEL. Valid values: error, warn, info, debug, trace" 1>&2 + exit 1 + ;; + esac +else + VERBOSITY=${GETH_VERBOSITY:-3} +fi GETH_DATA_DIR=${GETH_DATA_DIR:-/data} RPC_PORT="${RPC_PORT:-8545}" WS_PORT="${WS_PORT:-8546}" diff --git a/nethermind/nethermind-entrypoint b/nethermind/nethermind-entrypoint index 66367b22..ca4dab6b 100755 --- a/nethermind/nethermind-entrypoint +++ b/nethermind/nethermind-entrypoint @@ -3,7 +3,23 @@ set -eu # Default configurations NETHERMIND_DATA_DIR=${NETHERMIND_DATA_DIR:-/data} -NETHERMIND_LOG_LEVEL=${NETHERMIND_LOG_LEVEL:-Info} +# NETHERMIND_LOG_LEVEL accepts Nethermind log levels: Trace, Debug, Info, Warn, Error +# LOG_LEVEL accepts human-readable aliases and takes precedence when set +if [[ -n "${LOG_LEVEL:-}" ]]; then + case "$LOG_LEVEL" in + "error") NETHERMIND_LOG_LEVEL="Error" ;; + "warn") NETHERMIND_LOG_LEVEL="Warn" ;; + "info") NETHERMIND_LOG_LEVEL="Info" ;; + "debug") NETHERMIND_LOG_LEVEL="Debug" ;; + "trace") NETHERMIND_LOG_LEVEL="Trace" ;; + *) + echo "Invalid LOG_LEVEL: $LOG_LEVEL. Valid values: error, warn, info, debug, trace" 1>&2 + exit 1 + ;; + esac +else + NETHERMIND_LOG_LEVEL=${NETHERMIND_LOG_LEVEL:-Info} +fi RPC_PORT="${RPC_PORT:-8545}" WS_PORT="${WS_PORT:-8546}" diff --git a/reth/reth-entrypoint b/reth/reth-entrypoint index 0ffebc83..72e35eed 100755 --- a/reth/reth-entrypoint +++ b/reth/reth-entrypoint @@ -45,8 +45,8 @@ case "$LOG_LEVEL" in LOG_LEVEL="vvvvv" ;; *) - echo "Unknown log level: $LOG_LEVEL" - LOG_LEVEL="vvv" + echo "Invalid LOG_LEVEL: $LOG_LEVEL. Valid values: error, warn, info, debug, trace" 1>&2 + exit 1 ;; esac