Nothing magical to the two terms, just makes it easier to have a
tail/tee combo running while issuing the kill -QUIT cmd (v. via job
control, e.g).

For example, in terminal A:
prompt#tail -f /usr/local/tomcat/logs/catalina.out | tee /tmp/tomcat.dump.A

Now in terminal B:
prompt#ps -aef | egrep '[t]omcat'
    root 17660     1  0   Sep 01 ?        6:15 /usr/java/bin/java
-Dtomcat=1 -Xmx512m -Djava.awt.headl
    root  8918  8899  0 23:41:01 pts/3    0:00 tee /tmp/tomcat.dump.A
    root  8917  8899  0 23:41:01 pts/3    0:00 tail -f
/usr/local/tomcat/logs/catalina.out
prompt#kill -QUIT 17660
prompt#

After stopping the tail/tee combo in Term A (with Ctrl+C):
prompt#ls -alF /tmp/tomcat.dump.A
-rw-rw-r--   1 adir     adir       20096 Sep  2 23:43 /tmp/tomcat.dump.A

prompt#head /tmp/tomcat.dump.A
Full thread dump Java HotSpot(TM) Client VM (1.4.2_13-b06 mixed mode):

"Thread-52" daemon prio=5 tid=0x007dc168 nid=0x40 waiting on condition
[0xd0181000..0xd01819c8]
        at java.lang.Thread.sleep(Native Method)
        at org.apache.log4j.helpers.FileWatchdog.run(FileWatchdog.java:95)

"http80-Monitor" prio=5 tid=0x00355f18 nid=0x39 in Object.wait()
[0xd3081000..0xd30819c8]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xd9057088> (a
org.apache.tomcat.util.threads.ThreadPool$MonitorRunnable)
        at 
org.apache.tomcat.util.threads.ThreadPool$MonitorRunnable.run(ThreadPool.java:564)

prompt#tail /tmp/tomcat.dump.A
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:297)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398)

"VM Thread" prio=5 tid=0x000d1120 nid=0x4 runnable

"VM Periodic Task Thread" prio=10 tid=0x000d8110 nid=0xa waiting on condition
"Suspend Checker Thread" prio=10 tid=0x000d5140 nid=0x7 runnable

prompt#

On Wed, Sep 2, 2009 at 3:09 PM, keeplearning<p_sodh...@yahoo.com> wrote:
>
> Sorry. But I didn't understand how using 2 terminals would help me with the
> questions I posted.
>
>
>
> Jim Cox-2 wrote:
>>
>> FWIW, I usually do a tail/tee on catalina.out in a term, then do the
>> kill -QUIT <tomcat PID> from another term, then kill the tail/tee
>> combo which leaves me with a reasonably clean thread dump.
>>
>> For example:
>>
>> Terminal A:
>> prompt$ tail -f /usr/local/tomcat/logs/catalina.out | tee
>> /tmp/tomcat-threads.tmpA
>>
>> Terminal B:
>> prompt$ kill -QUIT 12345
>>
>>
>> On Wed, Sep 2, 2009 at 2:56 PM, keeplearning<p_sodh...@yahoo.com> wrote:
>>>
>>> Hi All,
>>>
>>> I have a quick question about getting thread dumps. I have been told that
>>> if
>>> I do kill -3 <process id>, it will send the thread dumps to catalina.out.
>>>
>>> Let say if I run test 1 and take 3 dumps. Then if I run test 2 and 3
>>> more.
>>> Do these get appended to first thread dumps I took?
>>>
>>> If yes, Let say if I run 3 different tests and take 3 dumps each test,
>>> how
>>> should I seperate those dumps as per specific tests. How do you guys
>>> normally do it?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/thread-dumps-catalina.out-tp25263566p25263566.html
>>> Sent from the Tomcat - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/thread-dumps-catalina.out-tp25263566p25263811.html
> Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to