Skip to content
Advertisement

How to log the number of available/used threads in a spring boot (tomcat) based application?

Is there a spring boot config where you can log the number of available/used threads the app server currently has?

Advertisement

Answer

You can use the actuator framework.

JavaScript

Then you have to enable tomcat JXM metrics in application.properties and expose the metrics endpoint

JavaScript

The go to http://localhost:8080/actuator/metrics/ and you will see all the available metrics.

For example current threads http://localhost:8080/actuator/metrics/tomcat.threads.current

Advertisement