IBM Support

Mapping Underlying Java Thread Identifiers to those in Logging and Trace

Question & Answer


Question

How do I map a thread identifier in a log or trace file (such as SystemOut.log) to an underlying Java thread identifier (found, for example, in a Javadump/Javacore)?

Cause

Different thread identifiers are printed in different logs by design for various reasons.

Answer

In recent versions of Traditional WebSphere Application Server (since PM60913) and WebSphere Liberty, the thread identifier in System*.log and messages.log, respectively, is the result of java/lang/Thread.getId. For example:

[1/21/20 13:54:28:281 PST] 00000067 SystemOut O Thread.getId()=0x67

The 8 characters following the timestamp represent a hexadecimal representation of Thread.getId on which the message was produced.

This getId identifier does not match the operating system native thread ID; however, this mapping may be made with thread dumps:

An IBM Java or OpenJ9 thread dump (a.k.a. javacore/javadump) shows the result of Thread.getId for each thread. In the following example, "java/lang/Thread getId:0x67" shows the result of getID which will match the WAS log and then "native thread ID:0x106E" is the OS native thread ID:

3XMTHREADINFO      "WebContainer : 7" J9VMThread:0x0000000004C82700, omrthread_t:0x0000153A040C9248, java/lang/Thread:0x00000000F3FBB0D8, state:R, prio=5
3XMJAVALTHREAD            (java/lang/Thread getId:0x67, isDaemon:true)
3XMTHREADINFO1            (native thread ID:0x106E, native priority:0x5, native policy:UNKNOWN, vmstate:R, vm thread flags:0x00001020)
3XMTHREADINFO2            (native stack address range from:0x0000153A35066000, to:0x0000153A350A6000, size:0x40000)
3XMCPUTIME               CPU usage total: 40.736697503 secs, current category="Application"
3XMHEAPALLOC             Heap bytes allocated since last GC cycle=0 (0x0)
3XMTHREADINFO3           Java callstack:
4XESTACKTRACE                at com/ibm/AllocateObject.doWork(AllocateObject.java:47(Compiled Code))
On recent versions of HotSpot, a thread dump shows the result of Thread.getId for each thread. In the following example, "#72" (in decimal) is the result of Thread.getId (and would show in WAS logs as 00000048) and "nid=0x12303" is the OS native thread ID:
"Default Executor-thread-24" #72 daemon prio=5 os_prio=31 cpu=30.77ms elapsed=54.58s tid=0x00007fb072573000 nid=0x12303 waiting on condition  [0x000070000b330000]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
        at java.lang.Thread.sleep([email protected]/Native Method)
        at com.ibm.Sleep.doSleep(Sleep.java:35)
        at com.ibm.Sleep.doWork(Sleep.java:18)

For an IBM Java and OpenJ9 system dump (a.k.a. OS core dump), the IBM Extensions for Memory Analyzer plugins provide a "WAS Thread ID" column in Open Query Browser } Java Basics } Thread Overview.

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"General","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"8.0;7.0;6.1;6.0;5.1","Edition":"","Line of Business":{"code":"LOB36","label":"IBM Automation"}},{"Product":{"code":"SSTVLU","label":"WebSphere eXtreme Scale"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"General","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.1;7.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
26 August 2020

UID

swg21418557