Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-145238: Add native thread ID to logging record attributes#145655

Open
mvanhorn wants to merge 1 commit intopython:mainfrom
mvanhorn:osc/145238-add-native-thread-id-logging
Open

gh-145238: Add native thread ID to logging record attributes#145655
mvanhorn wants to merge 1 commit intopython:mainfrom
mvanhorn:osc/145238-add-native-thread-id-logging

Conversation

@mvanhorn
Copy link

@mvanhornmvanhorn commentedMar 9, 2026
edited by github-actionsbot
Loading

Fixes#145238.

Adds anativeThreadId attribute toLogRecord that exposes the OS-native thread ID viathreading.get_native_id(). This is useful for correlating log entries with system tools likehtop,strace, andperf that display native thread IDs.

The attribute can be used in format strings as%(nativeThreadId)d.

On platforms whereget_native_id is not available, the attribute is set toNone.

This contribution was developed with AI assistance (Claude Code).


📚 Documentation preview 📚:https://cpython-previews--145655.org.readthedocs.build/

Add a `nativeThreadId` attribute to `LogRecord` that exposes theOS-native thread ID via `threading.get_native_id()`. This is usefulfor correlating log entries with system tools like htop, strace, andperf that display native thread IDs.The attribute can be used in format strings as `%(nativeThreadId)d`.Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mvanhornmvanhorn requested a review fromvsajip as acode ownerMarch 9, 2026 03:38
@python-cla-bot
Copy link

python-cla-botbot commentedMar 9, 2026
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vsajipvsajipAwaiting requested review from vsajipvsajip is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add threading.get_native_id as an available log record attribute to choose from.

1 participant

@mvanhorn

[8]ページ先頭

©2009-2026 Movatter.jp