diff --git a/src/admin/processor.rs b/src/admin/processor.rs index 67548f49..4f60f56e 100644 --- a/src/admin/processor.rs +++ b/src/admin/processor.rs @@ -15,7 +15,7 @@ use conduit::{ }, trace, utils::string::{collect_stream, common_prefix}, - Error, Result, + warn, Error, Result, }; use futures_util::future::FutureExt; use ruma::{ @@ -114,7 +114,15 @@ async fn process(context: &Command<'_>, command: AdminCommand, args: &[String]) fn capture_create(context: &Command<'_>) -> (Arc, Arc>) { let env_config = &context.services.server.config.admin_log_capture; - let env_filter = EnvFilter::try_new(env_config).unwrap_or_else(|_| "debug".into()); + let env_filter = EnvFilter::try_new(env_config).unwrap_or_else(|e| { + warn!("admin_log_capture filter invalid: {e:?}"); + cfg!(debug_assertions) + .then_some("debug") + .or(Some("info")) + .map(Into::into) + .expect("default capture EnvFilter") + }); + let log_level = env_filter .max_level_hint() .and_then(LevelFilter::into_level) diff --git a/src/core/config/mod.rs b/src/core/config/mod.rs index 71ffd7f3..547196e4 100644 --- a/src/core/config/mod.rs +++ b/src/core/config/mod.rs @@ -1079,6 +1079,11 @@ fn default_sentry_filter() -> String { "info".to_owned() } fn default_startup_netburst_keep() -> i64 { 50 } -fn default_admin_log_capture() -> String { "debug".to_owned() } +fn default_admin_log_capture() -> String { + cfg!(debug_assertions) + .then_some("debug") + .unwrap_or("info") + .to_owned() +} fn default_admin_room_tag() -> String { "m.server_notice".to_owned() }