Skip to content

Commit ee87f63

Browse files
michaelsproulethDreamer
authored andcommitted
Reintroduce --logfile with deprecation warning (sigp#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: - sigp#6339
1 parent 4d13bb9 commit ee87f63

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

beacon_node/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ pub fn get_config<E: EthSpec>(
278278
}
279279

280280
if clap_utils::parse_optional::<u64>(cli_args, "eth1-cache-follow-distance")?.is_some() {
281-
warn!("The eth1-purge-cache flag is deprecated");
281+
warn!("The eth1-cache-follow-distance flag is deprecated");
282282
}
283283

284284
// `--execution-endpoint` is required now.

lighthouse/src/main.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ fn main() {
126126
.global(true)
127127
.display_order(0),
128128
)
129+
.arg(
130+
Arg::new("logfile")
131+
.long("logfile")
132+
.value_name("PATH")
133+
.help("DEPRECATED")
134+
.action(ArgAction::Set)
135+
.global(true)
136+
.hide(true)
137+
.display_order(0)
138+
)
129139
.arg(
130140
Arg::new("logfile-dir")
131141
.long("logfile-dir")
@@ -701,6 +711,11 @@ fn run<E: EthSpec>(
701711
// Allow Prometheus access to the version and commit of the Lighthouse build.
702712
metrics::expose_lighthouse_version();
703713

714+
// DEPRECATED: can be removed in v7.2.0/v8.0.0.
715+
if clap_utils::parse_optional::<PathBuf>(matches, "logfile")?.is_some() {
716+
warn!("The --logfile flag is deprecated and replaced by --logfile-dir");
717+
}
718+
704719
#[cfg(all(feature = "modern", target_arch = "x86_64"))]
705720
if !std::is_x86_feature_detected!("adx") {
706721
tracing::warn!(

lighthouse/tests/beacon_node.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2476,6 +2476,13 @@ fn logfile_format_flag() {
24762476
)
24772477
});
24782478
}
2479+
// DEPRECATED but should not crash.
2480+
#[test]
2481+
fn deprecated_logfile() {
2482+
CommandLineTest::new()
2483+
.flag("logfile", Some("test.txt"))
2484+
.run_with_zero_port();
2485+
}
24792486

24802487
// DEPRECATED but should not crash.
24812488
#[test]

0 commit comments

Comments
 (0)