Python How to display thread id in python logs You can automatically add thread ids to your log statements using Python's logging module with LogRecord. LogRecord provides 2 attributes for thread related information: threadName and thread. %(thread)d : Thread ID (if available)