From 641daa3fc86b7883bd794c6dc9f0c601c9289d24 Mon Sep 17 00:00:00 2001 From: Emmanuel Bosquet Date: Wed, 18 Oct 2023 17:08:59 +0200 Subject: [PATCH] send logging level change requests to workers --- bin/src/command/requests.rs | 18 ++++++++++++++++-- lib/src/server.rs | 1 - 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/bin/src/command/requests.rs b/bin/src/command/requests.rs index 2769d6cc2..10ec7bfd9 100644 --- a/bin/src/command/requests.rs +++ b/bin/src/command/requests.rs @@ -64,7 +64,9 @@ impl CommandServer { Err(_) => Err(anyhow::Error::msg("wrong i32 for metrics configuration")), } } - Some(RequestType::Logging(logging_filter)) => self.set_logging_level(logging_filter), + Some(RequestType::Logging(logging_filter)) => { + self.set_logging_level(logging_filter, client_id).await + } Some(RequestType::SubscribeEvents(_)) => { self.event_subscribers.insert(client_id.clone()); Ok(Some(Success::SubscribeEvent(client_id.clone()))) @@ -1187,7 +1189,11 @@ impl CommandServer { Ok(None) } - pub fn set_logging_level(&mut self, logging_filter: String) -> anyhow::Result> { + pub async fn set_logging_level( + &mut self, + logging_filter: String, + client_id: String, + ) -> anyhow::Result> { debug!("Changing main process log level to {}", logging_filter); logging::LOGGER.with(|l| { let directives = logging::parse_logging_spec(&logging_filter); @@ -1197,6 +1203,14 @@ impl CommandServer { // will have the new logging filter value ::std::env::set_var("RUST_LOG", &logging_filter); debug!("Logging level now: {}", ::std::env::var("RUST_LOG")?); + + // notify the workers too + let _worker_success = self + .worker_requests( + client_id, + RequestType::Logging(logging_filter.clone()).into(), + ) + .await?; Ok(Some(Success::Logging(logging_filter))) } diff --git a/lib/src/server.rs b/lib/src/server.rs index ae9721560..12811decc 100644 --- a/lib/src/server.rs +++ b/lib/src/server.rs @@ -957,7 +957,6 @@ impl Server { } _other_request => {} } - self.notify_proxys(message); }