Skip to content

Commit a45d51a

Browse files
authored
Avoid double shutdown of logger provider (#878)
1 parent a40636b commit a45d51a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

logfire/_internal/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,9 +1017,9 @@ def fix_pid(): # pragma: no cover
10171017
logger_provider.add_log_record_processor(root_log_processor)
10181018

10191019
with contextlib.suppress(Exception):
1020+
# This also shuts down the underlying self._logger_provider
10201021
self._event_logger_provider.shutdown()
1021-
with contextlib.suppress(Exception):
1022-
self._logger_provider.shutdown()
1022+
10231023
self._logger_provider.set_provider(logger_provider)
10241024

10251025
if self is GLOBAL_CONFIG and not self._has_set_providers:

tests/test_configure.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@
7272
PROCESS_RUNTIME_VERSION_REGEX = r'(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)'
7373

7474

75+
@pytest.fixture(autouse=True)
76+
def no_log_on_config(config: None, caplog: pytest.LogCaptureFixture) -> None:
77+
assert not caplog.messages
78+
79+
7580
def test_propagate_config_to_tags(exporter: TestExporter) -> None:
7681
tags1 = logfire.with_tags('tag1', 'tag2')
7782
tags2 = logfire.with_tags('tag3', 'tag4')

0 commit comments

Comments
 (0)