Skip to content

Always use LogRecord.getMessage to get the log body#4372

Merged
aabmass merged 7 commits into
open-telemetry:mainfrom
pR0Ps:bugfix/record-getmessage-compatibility
May 8, 2026
Merged

Always use LogRecord.getMessage to get the log body#4372
aabmass merged 7 commits into
open-telemetry:mainfrom
pR0Ps:bugfix/record-getmessage-compatibility

Conversation

@pR0Ps
Copy link
Copy Markdown
Contributor

@pR0Ps pR0Ps commented Mar 28, 2026

Description

This change makes the log exporting always call LogRecord.getMessage() in order to format and return the record's body text. This is a port of open-telemetry/opentelemetry-python#4327 to this new repo. See that pull request for more details and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I've updated and run the unit tests, as well as run manual tests of the functionality (see open-telemetry/opentelemetry-python#4216 for details)

Does This PR Require a Core Repo Change?

  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

Copy link
Copy Markdown
Member

@pmcollins pmcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this. I'm in favor of this change, but because it's breaking, it probably warrants a discussion in the weekly SIG meeting. @pR0Ps not sure if you attend these already, but you are welcome to join if you are interested.

Comment thread CHANGELOG.md Outdated
@tammy-baylis-swi tammy-baylis-swi moved this to Ready for review in Python PR digest Apr 2, 2026
Copy link
Copy Markdown
Member

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. I agree with @pmcollins the changelog needs to indicate this is a breaking change.

PS the description references the core PR (#4327) for context, but that PR itself links to additional background that's useful for reviewers:

  • open-telemetry/opentelemetry-python#4216 — the original issue and discussion that motivated this change
  • open-telemetry/opentelemetry-python#3343 — the PR this is mostly reverting

Probably worth adding those directly to the description here so reviewers don't have to chase the chain 😄

Comment thread CHANGELOG.md Outdated
@MikeGoldsmith
Copy link
Copy Markdown
Member

Has this been discussed at a SIG call? I agree this probably the right thing to do, but would like other @open-telemetry/python-approvers to give input as it's a breaking change.

@pmcollins
Copy link
Copy Markdown
Member

Has this been discussed at a SIG call? I agree this probably the right thing to do, but would like other @open-telemetry/python-approvers to give input as it's a breaking change.

Hey @MikeGoldsmith, ran out of time last week, but hope to discuss tomorrow.

Copy link
Copy Markdown
Member

@pmcollins pmcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi -- discussed this in the SIG meeting and folks seem to be in favor of this change. The fact that it has been moved out of the SDK give us some additional flexibility. Added a suggestion about the changelog entry.

Comment thread CHANGELOG.md Outdated
@github-project-automation github-project-automation Bot moved this from Ready for review to Approved PRs in Python PR digest Apr 13, 2026
@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions Bot added the Stale label Apr 28, 2026
@pR0Ps
Copy link
Copy Markdown
Contributor Author

pR0Ps commented Apr 28, 2026

Not stale. @MikeGoldsmith @pmcollins anything else I need to do for this?

@github-actions github-actions Bot removed the Stale label Apr 29, 2026
@aabmass aabmass enabled auto-merge (squash) May 8, 2026 21:44
@aabmass
Copy link
Copy Markdown
Member

aabmass commented May 8, 2026

Sorry for the delay, thanks for contributing

Comment thread instrumentation/opentelemetry-instrumentation-logging/tests/test_handler.py Outdated
@aabmass aabmass merged commit c87e487 into open-telemetry:main May 8, 2026
753 checks passed
@github-project-automation github-project-automation Bot moved this from Approved PRs to Done in Python PR digest May 8, 2026
@pR0Ps pR0Ps deleted the bugfix/record-getmessage-compatibility branch May 9, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants