Repository navigation
Preserve logging state when initialization fails - #4
Merged
Merged
Conversation
ctoth
force-pushed
the
improve/crash-lifetime
branch
from
October 29, 2026 18:31
719bf0b to
ecc6e28
Compare
ctoth
force-pushed
the
improve/atomic-initialization
branch
from
October 29, 2026 18:31
87875c3 to
c1ab023
Compare
ctoth
force-pushed
the
improve/atomic-initialization
branch
from
October 29, 2026 18:39
c1ab023 to
f47d03a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Keep a failed logging initialization from installing partial handlers or replacing the exception hook.
State
Construct and format handlers before attaching them or changing process logging state. Close constructed handlers when a later setup step fails. This PR is independently based on integrated master and contains no other open PR's commits.
Decisions and why
The framework catches setup failures and continues. Leaving an error handler installed when opening the debug file fails previously made its basicConfig fallback a no-op. A failure now preserves pre-existing root handlers, root level and exception hook. Fatal handling is enabled only after handler construction succeeds. File opens may still create or truncate files; this change does not roll back their contents.
Surprises
create_handler is an internal module helper, not exported by the package. Its callers now receive an unattached handler; setup_logging attaches only the completed set. No consumer call site changes are required.
Next step
Read the existing package checks. The separate app_framework failure-reporting PR makes its fallback status accurate. No merge or release.