Collect Thread Dump and Heap Dump on Linux App Service (Java/Tomcat)
Published Sep 09 2022 01:21 AM 5,148 Views
Microsoft

The following steps can be followed for both our Java and Tomcat offerings on Linux App Service. Note that, if you are using a custom image, you could enable webSSH and collect dumps using jcmd, if present.

 

1. Go to the Kudu Site of the WebApp via Advanced Tools blade:

 

gaukazure_0-1662663457471.png

 

2. Click on SSH to ssh into the Application Container:

 

gaukazure_1-1662663500040.png

3. Get the PID of the Java Process (your application):

[There are multiple ways to get it. We can use ps -ef | grep java | grep -v grep command, or simply run jcmd]

 

gaukazure_2-1662663625655.png

 

4. Finally, execute the following command to collect the Thread Dump and save it as a file. 

 

jcmd <PID of Java Process> Thread.print > /home/threaddump


Similarly, to collect the heap dump, run:

jcmd <PID of Java Process> GC.heap_dump /home/heapdump

 

gaukazure_3-1662663761325.png

 

Note:

The files under /home are only persistent by default. Consider collecting the dumps under /home or in the mounted location for External Storage (if using BYOS)

 

 

Co-Authors
Version history
Last update:
‎Sep 09 2022 01:21 AM
Updated by: