File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515from .traces import NoOpTrace , Trace , TraceImpl
1616
1717
18+ def _safe_debug (message : str ) -> None :
19+ """Best-effort debug logging that tolerates closed streams during shutdown."""
20+ try :
21+ logger .debug (message )
22+ except Exception :
23+ # Avoid noisy shutdown errors when the underlying stream is already closed.
24+ return
25+
26+
1827class SynchronousMultiTracingProcessor (TracingProcessor ):
1928 """
2029 Forwards all calls to a list of TracingProcessors, in order of registration.
@@ -84,7 +93,7 @@ def shutdown(self) -> None:
8493 Called when the application stops.
8594 """
8695 for processor in self ._processors :
87- logger . debug (f"Shutting down trace processor { processor } " )
96+ _safe_debug (f"Shutting down trace processor { processor } " )
8897 try :
8998 processor .shutdown ()
9099 except Exception as e :
@@ -315,7 +324,7 @@ def shutdown(self) -> None:
315324 return
316325
317326 try :
318- logger . debug ("Shutting down trace provider" )
327+ _safe_debug ("Shutting down trace provider" )
319328 self ._multi_processor .shutdown ()
320329 except Exception as e :
321330 logger .error (f"Error shutting down trace provider: { e } " )
You can’t perform that action at this time.
0 commit comments