Repository navigation
Conversation
node, beacon and validator take --log-level <error|warn|info|debug|trace>. It sets the floor node_log_filter hard-coded as info. RUST_LOG still adds per-target directives on top of it, and the gossipsub cap stays unless a directive names that target. Without the flag nothing changes. Closes lambdaclass#821
yash251
force-pushed
the
yash/821-log-level-flag
branch
from
December 2, 2026 07:50
1f75fc6 to
3fecdd4
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🗒️ Description / Motivation
--log-level <error|warn|info|debug|trace>tonode,beaconandvalidator.RUST_LOG, so it did not show up in--help, and launchers that only build a command line (ethereum-package, docker-compose, systemd units) had to set an environment variable instead.node_log_filterhard-coded asinfo.RUST_LOGstill layers per-target directives on top of it, and the gossipsub cap stays unless a directive names that target.What Changed
bin/ethlambda/src/cli.rs:--log-levelonCommonOptions(sonodeandbeaconboth get it), plus theLOG_LEVELSlist of accepted values.bin/ethlambda/src/validator.rs: the same flag onValidatorOptions.bin/ethlambda/src/main.rs:init_node_loggingandnode_log_filtertake the flag's value. The three sub-commands pass it in.bin/ethlambda/src/command.rs: a parse test for the three sub-commands.docs/cli.md: a row in the common flag table and in thevalidatorflag table.Correctness / Behavior Guarantees
RUST_LOGvalue is the same as before, apart from a leading empty directive that the parser skips. The three existing filter tests pass unchanged.<level>,libp2p_gossipsub=error,<RUST_LOG>. So:--log-level debuglogs everything at DEBUG, with gossipsub still capped at ERROR.--log-level debugwithRUST_LOG=ethlambda_p2p=tracekeeps the DEBUG floor and adds TRACE for that crate.RUST_LOG=libp2p_gossipsub=warnstill lifts the cap.RUST_LOG(for exampleRUST_LOG=warn) replaces the flag's level, the same way it replaces the defaultinfotoday.RUST_LOGholds only per-target directives, the floor is still replaced, asrust_log_without_a_floor_still_replaces_itpins today. I kept that so this PR changes no existing behavior. If you would rather haveinfoalways apply as the floor, it is a one-line change and I am happy to make it.Option, so--helplists the possible values and the doc comment states theinfodefault.Tests Added / Run
Added:
log_level_sets_the_floor_and_keeps_the_gossipsub_cap(main.rs):debuglets DEBUG through and keeps gossipsub warnings out.warndrops INFO and keeps gossipsub errors.rust_log_layers_on_top_of_the_log_level_floor(main.rs):--log-level debugwithRUST_LOG=libp2p_gossipsub=warnkeeps the DEBUG floor and lifts the cap.the_long_running_sub_commands_take_a_log_level(command.rs):node,beaconandvalidatoreach accept--log-level debugand reject--log-level verbose.Commands run:
cargo test --locked -p ethlambda: 363 passed, 0 failed, 4 ignored, plus the two integration test binaries (1 passed each).cargo test --locked --profile release-fast -p ethlambda --features ethlambda/include-ethrex(the binary's part ofmake test-ethrex): 371 passed, 0 failed, 4 ignored, plus the two integration test binaries.node_log_filter, the two new filter tests fail. With the change they pass.make fmt: clean.make lint: clean, all passes.make testlocally. The change is confined tobin/ethlambda, so I ran that package's tests as above and left the last box unticked for CI.Related Issues / PRs
✅ Verification Checklist
make fmt- cleanmake lint(clippy with-D warnings) - cleanmake test(test-consensus,test-nodeandtest-ethrex, atrelease-fast) - all passing