Repository navigation
Allow setting the log level and log file via env and CLI - #331
Merged
benthecarman merged 1 commit intoNov 10, 2026
Merged
benthecarman merged 1 commit into
benthecarman merged 1 commit into
Conversation
`[log] level` and `[log] file` could only be set in the config file, while the other log options and the rest of the config can also be set through `LDK_SERVER_*` environment variables and CLI flags, as docs/configuration.md describes. Add `--log-level` / `LDK_SERVER_LOG_LEVEL` and `--log-file` / `LDK_SERVER_LOG_FILE`, merged like the other args so they override the config file. The level is still validated in `build()`. The args-config tests listed these fields in their expected configs but never asserted them; assert them now, and cover an invalid level given through the args. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I've assigned @benthecarman as a reviewer! |
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.
docs/configuration.mdsays every config key can also be set through anLDK_SERVER_*environment variable or a CLI flag.[log] leveland[log] filecould only be set in the TOML:ArgsConfighad flags for the other four log keys (max_size_mb,rotation_interval_hours,max_files,log_to_file) but not these two.We hit this while running ldk-server under systemd: raising the log level for a debugging session meant generating a second config file and overriding
ExecStart, instead of a one-lineEnvironment=LDK_SERVER_LOG_LEVEL=Debugdrop-in.Change
ArgsConfig:--log-level/LDK_SERVER_LOG_LEVELand--log-file/LDK_SERVER_LOG_FILE, next to the existing log flags. They follow the same TOML-key → flag → env naming.merge_args: both override the TOML value, like every other arg. The level string is still validated inbuild(), so an invalid value from the environment fails exactly like an invalid TOML value.default_args_config()now sets both.test_config_from_args_configandtest_args_config_overrides_fileassertlog_levelandlog_file_path. Their expected configs already listed these fields, but no assertion checked them.test_invalid_log_level_in_args_configcovers the error path.docs/configuration.md: the[log]section names the two new flags and variables.Testing
Mirroring the MSRV leg of
build.yml, withidna_adapterpinned to 1.2.0:cargo +1.85.0 clippy --all-features -- -D warnings: clean.cargo +1.85.0 test --all-features: all suites pass.cargo fmt --all -- --check, and the same fore2e-tests: clean.ldk-server --helplists both flags with their env names.Unrelated to this change: clippy on current stable (1.98) reports
result_large_errtwice inldk-server-cli/src/pay_wait.rs(lines 100 and 119). CI runs clippy only on 1.85, so it doesn't fail there.Disclosure: this change was written with an AI coding assistant (Claude Code); we reviewed it and ran the tests above.