Reintroduce --logfile with deprecation warning (#7723)

Reintroduce the `--logfile` flag with a deprecation warning so that it doesn't prevent nodes from starting. This is considered preferable to breaking node startups so that users fix the flag, even though it means the `--logfile` flag is completely ineffective.

The flag was initially removed in:

- https://github.com/sigp/lighthouse/pull/6339
This commit is contained in:
Michael Sproul
2025-07-09 18:08:27 +10:00
committed by GitHub
parent 7b2f138ca7
commit 8e55684b06
3 changed files with 23 additions and 1 deletions

View File

@@ -278,7 +278,7 @@ pub fn get_config<E: EthSpec>(
}
if clap_utils::parse_optional::<u64>(cli_args, "eth1-cache-follow-distance")?.is_some() {
warn!("The eth1-purge-cache flag is deprecated");
warn!("The eth1-cache-follow-distance flag is deprecated");
}
// `--execution-endpoint` is required now.

View File

@@ -126,6 +126,16 @@ fn main() {
.global(true)
.display_order(0),
)
.arg(
Arg::new("logfile")
.long("logfile")
.value_name("PATH")
.help("DEPRECATED")
.action(ArgAction::Set)
.global(true)
.hide(true)
.display_order(0)
)
.arg(
Arg::new("logfile-dir")
.long("logfile-dir")
@@ -701,6 +711,11 @@ fn run<E: EthSpec>(
// Allow Prometheus access to the version and commit of the Lighthouse build.
metrics::expose_lighthouse_version();
// DEPRECATED: can be removed in v7.2.0/v8.0.0.
if clap_utils::parse_optional::<PathBuf>(matches, "logfile")?.is_some() {
warn!("The --logfile flag is deprecated and replaced by --logfile-dir");
}
#[cfg(all(feature = "modern", target_arch = "x86_64"))]
if !std::is_x86_feature_detected!("adx") {
tracing::warn!(

View File

@@ -2476,6 +2476,13 @@ fn logfile_format_flag() {
)
});
}
// DEPRECATED but should not crash.
#[test]
fn deprecated_logfile() {
CommandLineTest::new()
.flag("logfile", Some("test.txt"))
.run_with_zero_port();
}
// DEPRECATED but should not crash.
#[test]