From 0c43935befc97b91064f92407d7b6883529521a5 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Fri, 16 May 2025 00:26:44 +0200 Subject: [PATCH] Avoid creating more than one log subscriber (when integration tests are running) --- backend/src/log.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/src/log.rs b/backend/src/log.rs index 720b2b2..fe2917c 100644 --- a/backend/src/log.rs +++ b/backend/src/log.rs @@ -94,9 +94,16 @@ impl Log { .with_thread_ids(TRACING_DISPLAY_THREAD) .with_thread_names(TRACING_DISPLAY_THREAD); - tracing_subscriber::Registry::default() + if let Err(error) = tracing_subscriber::Registry::default() .with(layer_stdout) - .init(); + .try_init() + { + // It happens during the integration tests. + eprintln!( + "Error during initialization of the tracing subscriber: {}", + error + ); + } Log::StdoutOnly }