Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I relate the thread id from the SystemOut.log file to a thread in a

127 views
Skip to first unread message

Reinout Korbee

unread,
May 27, 2009, 6:20:50 AM5/27/09
to
Hi, I have many many messages in SystemOut that I need to find out which application/ component/ package/ class is writing them. There are a few hundred ear files installed on this server. I was thinking to create a heap dump and relate the thread id from system out to a thread in the dump and find out which classes are on this thread. With the package name of the class I can work out the application/ project writing those log messages. So far the theory. I created a heap dump with kill -3, on Solaris 8, with java 1.4.2, websphere AS 5.1 (I set -XX:+HeapDumpOnStrlBreak first). I ran this hprof binary file through the SAP Eclipse Memory Analyzer but I can't find the thread id I see in SystemOut.log.

For example:

[5/27/09 11:14:15:084 MEST] 1124a9b SystemOut O startTag.getSourceText()=

1124a9b is the thread id and I want to know which classes are loaded on this thread because writing this type of message in SystemOut is not allowed in our environment. Also a thread dump didn't give me the answer I was looking for.

So the question is:

How can I relate the thread id from the SystemOut.log file to a thread in a heap dump?

Ken Hygh

unread,
May 27, 2009, 7:06:44 AM5/27/09
to

You cannot. There's no correlation between threads and classloading.

Go to the source library and start using grep.

Ken

fyl...@sohu.com

unread,
Jun 2, 2009, 2:58:47 AM6/2/09
to
You can generate a java core dump instead of a heap dump to do so. The java core dump will print out stack trace for each thread.

David Yang

unread,
Jun 15, 2009, 11:00:01 AM6/15/09
to
Hello,
You might be able to do something like technote *Determining which Java thread is consuming CPU cycles on Solaris systems* at http://www.ibm.com/support/docview.wss?rs=180&uid=swg21162381. But I am not sure if that will get you what you want either.

Otherwise, you may create a PMR to try to answer your question.

Thank you,
David Yang
WebSphere Portal support

The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.

and...@us.ibm.com

unread,
Jun 15, 2009, 11:25:48 AM6/15/09
to
This is a tricky problem to solve. The thread ID in the WAS output logs (SystemOut.log, SystemErr.log, and trace.log) are based on the [java.util.logging.LogRecord API|http://java.sun.com/javase/6/docs/api/java/util/logging/LogRecord.html#getThreadID()] which states the the ID may not map to any operating system ID. Thread and heap dumps both report the OS IDs and not the log record ID...

The thread ID from LogRecord must be associated with the thread itself somehow - my guess would be a ThreadLocal object. If this is correct, then your heap dump might contain the LogRecord integer in a ThreadLocal associated with the thread (you might need to convert the thread ID back to decimal to compare).

Certainly, this is not an easy thing to do (if it works at all...), but hopefully it will work for you. If you find another approach, please post it here - I'm very interested in seeing a solution to this myself.

Good luck,
Andy

Reinout Korbee

unread,
Jun 16, 2009, 4:38:52 AM6/16/09
to
An official Bug Report was created for this some time ago at Sun:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6278014

According to this page it was released for Java version 7 if I interpreted it correctly. This means that for Websphere 5 there's no solution to this issue.

0 new messages