File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
src/opentelemetry/sdk/_shared_internal Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 4040
4141
4242class DuplicateFilter (logging .Filter ):
43- """This prevents logs generated when a log fails to be written to generate another log which fails to be written"""
43+ """Filter that can be applied to internal `logger`'s.
44+
45+ Currently applied to `logger`s on the export logs path that could otherwise cause endless logging of errors or a
46+ recursion depth exceeded issue in cases where logging itself results in an exception."""
4447
4548 def filter (self , record ):
4649 current_log = (
Original file line number Diff line number Diff line change @@ -251,11 +251,12 @@ def test_shutdown_allows_1_export_to_finish(
251251 assert "Exception while exporting" in caplog .text
252252 assert 2 == exporter .num_export_calls
253253
254+
254255class TestCommonFuncs (unittest .TestCase ):
255256 def test_duplicate_logs_filter_works (self ):
256257 test_logger = logging .getLogger ("testLogger" )
257258 test_logger .addFilter (DuplicateFilter ())
258259 with self .assertLogs ("testLogger" ) as cm :
259260 test_logger .info ("message" )
260261 test_logger .info ("message" )
261- self .assertEqual (len (cm .output ), 1 )
262+ self .assertEqual (len (cm .output ), 1 )
You can’t perform that action at this time.
0 commit comments