Skip to content

Preserve logging state when initialization fails - #4

Merged
ctoth merged 1 commit into
masterfrom
improve/atomic-initialization
Oct 29, 2026
Merged

ctoth merged 1 commit into
masterfrom
improve/atomic-initialization

Conversation

@ctoth

@ctoth ctoth commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

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.

@ctoth
ctoth force-pushed the improve/crash-lifetime branch from 719bf0b to ecc6e28 Compare October 29, 2026 18:31
@ctoth
ctoth force-pushed the improve/atomic-initialization branch from 87875c3 to c1ab023 Compare October 29, 2026 18:31
@ctoth
ctoth changed the base branch from improve/crash-lifetime to master October 29, 2026 18:31
@ctoth
ctoth force-pushed the improve/atomic-initialization branch from c1ab023 to f47d03a Compare October 29, 2026 18:39
@ctoth
ctoth merged commit f20fa83 into master Oct 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant