Skip to content

gh-137790 Add an option to logging.Formatter to always set record.exc_text even if it's not None #137802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Harry-Kwon
Copy link

@Harry-Kwon Harry-Kwon commented Aug 15, 2025

Adds an optional field set_exc_text to logging.Formatter so that the exc_text field of the log record is always set even if it is not None.

Provides an option to bypass the issue in #137790 where only the first formatter will update exc_text if multiple handlers with formatters are added to a logger.

@python-cla-bot
Copy link

python-cla-bot bot commented Aug 15, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app bedevere-app bot added the tests Tests in the Lib/test dir label Aug 15, 2025
@bedevere-app
Copy link

bedevere-app bot commented Aug 15, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant