I have an Azure App Service running Tomcat 8.5 and can't seem to figure out how to do a thread dump. jstack is not recognized in the Console nor the DebugConsole.
On Azure App Service, all popular versions of Java had been installed at the path D:\\Program Files (x86)\\Java
. Take version 1.8.0u73 as example, please see the figure below.
You can command set PATH=D:\\Program Files (x86)\\Java\\jdk1.8.0_73\\bin;%PATH%
to add Java tools to the environment temporarily via the Kudu console tool. Then, the jstack
tool is available in the current Kudu session.
Inspired by the previous answer, I created the following bat script (could be powershell, I suppose) that does the job:
powershell -Command "get-process java |select -expand id" > pid.txt
set /p id= < pid.txt
"%JAVA_HOME%\bin\jstack" -F %id% > out.txt
It uses the java version that you're using in your app (JAVA_HOME) and doesn't require any input from you. It's simple and does the trick. Just create a bat file in your wwwroot, for example, and run it whenever you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.