Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass logging level change to workers #1006

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions bin/src/command/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())))
Expand Down Expand Up @@ -1187,7 +1189,11 @@ impl CommandServer {
Ok(None)
}

pub fn set_logging_level(&mut self, logging_filter: String) -> anyhow::Result<Option<Success>> {
pub async fn set_logging_level(
&mut self,
logging_filter: String,
client_id: String,
) -> anyhow::Result<Option<Success>> {
debug!("Changing main process log level to {}", logging_filter);
logging::LOGGER.with(|l| {
let directives = logging::parse_logging_spec(&logging_filter);
Expand All @@ -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)))
}

Expand Down
1 change: 0 additions & 1 deletion lib/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,6 @@ impl Server {
}
_other_request => {}
}

self.notify_proxys(message);
}

Expand Down
Loading