From 665e275dc52521217d31c5e4aa45103499e03cbd Mon Sep 17 00:00:00 2001 From: pjsier Date: Wed, 28 Dec 2022 18:30:25 -0600 Subject: [PATCH] Log message to stderr if LOG_FILE is not writable Co-authored-by: Helmut K. C. Tessarek --- src/config.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/config.rs b/src/config.rs index 173a1f6e..1b99cea0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -678,6 +678,12 @@ fn validate_config(cfg: &ConfigItems) -> Result<(), Error> { err!(format!("`DATABASE_MAX_CONNS` contains an invalid value. Ensure it is between 1 and {}.", limit,)); } + if let Some(log_file) = &cfg.log_file { + if std::fs::OpenOptions::new().append(true).create(true).open(log_file).is_err() { + err!("Unable to write to log file", log_file); + } + } + let dom = cfg.domain.to_lowercase(); if !dom.starts_with("http://") && !dom.starts_with("https://") { err!(