LoginSignup
78
75

More than 5 years have passed since last update.

Javaのスレッドダンプを取得する

Last updated at Posted at 2013-08-27

こっちが最新版
Javaのスレッドダンプ、ヒープダンプの取り方 - Qiita [キータ]

1. JavaのプロセスIDを確認
$ ps aux | grep java

PIDがわかれば良いのでpsのオプションはお好みで…
と思ってましたが、コメントでもっと簡単な方法を教えていただきました

$ $JAVA_HOME/bin/jps
27046 Application
26616 Jps
2. スレッドダンプ取得
$ $JAVA_HOME/bin/jstack 27046 > threaddump.txt

おまけ

以前はjstackを知らず、kill -3でやっていた時代もありました。
アプリのログがすべてcatalina.outに出ていたので

$ cp catalina.out{,.tmp}
$ kill -3 [PID]
$ diff catalina.out{,.tmp} > threaddump.txt

めんどくさいですね!

78
75
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
78
75