Logging API accepts optional Context at LogRecord init else get_current; deprecates trace_id, span_id, trace_flags by tammy-baylis-swi · Pull Request #4597 · open-telemetry/opentelemetry-python

added 9 commits

May 22, 2025 12:33

@tammy-baylis-swi tammy-baylis-swi changed the title Logs API/SDK accepts additional, optional Context Logging API accepts optional Context with priority over trace_id etc, and LoggingHandler passes current Context

May 24, 2025

@tammy-baylis-swi

@tammy-baylis-swi

@tammy-baylis-swi

aabmass

@tammy-baylis-swi

@tammy-baylis-swi

@tammy-baylis-swi tammy-baylis-swi changed the title Logging API accepts optional Context with priority over trace_id etc, and LoggingHandler passes current Context Logging API accepts optional Context at LogRecord init else get_current; deprecates trace_id, span_id, trace_flags

Jun 11, 2025

@tammy-baylis-swi

@tammy-baylis-swi

emdneto

xrmx

xrmx

xrmx approved these changes Jun 16, 2025

@emdneto

This was referenced

Jun 19, 2025

JWinermaSplunk pushed a commit to JWinermaSplunk/opentelemetry-python that referenced this pull request

Feb 17, 2026
…nt; deprecates trace_id, span_id, trace_flags (open-telemetry#4597)

* Logs API/SDK accepts additional otel context

* Changelog

* LoggingHandler translates to LogRecord with current Otel context

* Add LogRecord init priority for context's span over old span info

* Add LogRecord serialized_context for to_json of arbitrary objects

* Add test coverage

* Changelog

* lint

* Fix tests

* Changelog

* Rm Context inclusion from to_json of LogRecord

* Revision: logs SDK does get_current, overload init and deprecate trace_id etc

* Simplify test

* Changelog

* Use typing_extensions deprecated, not custom

* Update LogRecord API; simplify test

* Force logrecord api kwarg-only to avoid param order issues

* Add special LogDeprecatedInitWarning that logs once

* Rm deprecated decorator

* api too

* catch_warnings instead of assertLogs in test

* changelog

* Rm with assertLogs for py3.13 ubuntu test

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>

JWinermaSplunk pushed a commit to JWinermaSplunk/opentelemetry-python that referenced this pull request

Feb 17, 2026
…nt; deprecates trace_id, span_id, trace_flags (open-telemetry#4597)

* Logs API/SDK accepts additional otel context

* Changelog

* LoggingHandler translates to LogRecord with current Otel context

* Add LogRecord init priority for context's span over old span info

* Add LogRecord serialized_context for to_json of arbitrary objects

* Add test coverage

* Changelog

* lint

* Fix tests

* Changelog

* Rm Context inclusion from to_json of LogRecord

* Revision: logs SDK does get_current, overload init and deprecate trace_id etc

* Simplify test

* Changelog

* Use typing_extensions deprecated, not custom

* Update LogRecord API; simplify test

* Force logrecord api kwarg-only to avoid param order issues

* Add special LogDeprecatedInitWarning that logs once

* Rm deprecated decorator

* api too

* catch_warnings instead of assertLogs in test

* changelog

* Rm with assertLogs for py3.13 ubuntu test

---------

Co-authored-by: Emídio Neto <9735060+emdneto@users.noreply.github.com>