Wednesday, September 13, 2006

Getting insights in a running Spring application via JMX

During development it is often practical to be able to get more information about what is going on in a running JVM, e.g.
  • what Spring configuration was loaded (taking into account all the overridden configuration),
  • what threads are running and with what properties,
  • what interceptors are present on what spring beans
The EL4J JMX module allows exactly this. You just add a dependency from your application module to the JMX module and automatically have this and more information available via any web browser.

Here are some screenshots to illustrate this:

First we show the JMX overview page:



Clicking on the fooBean leads to the following view:



Clicking on the Configuration property shows the config values of the bean:




Which corresponds to following spring configuration:


You can also see all the threads that run in the JVM with their attributes:



Additional features:
  • Change the log4j logging level for a certain package during runtime
  • Get the current configuration location of log4j
  • See the measurements from the JaMON performance measuring interceptor
  • Activate log4j appenders during runtime (e.g. to get more info in case of problems)
  • See all system properties defined in the JVM (e.g. to get the current CLASSPATH)
  • Get the order of the configuration files as Spring reads them
All this is available with just the addition of a reference to the JMX module. Remark: to make the spring configuration available to JMX, it is required to use a subclass of the normal XMLApplicationContext.

No comments: