Search code examples
javaspringweb-applicationsservletsstatus

Is there any reusable JSP / Servlet / framework to export jvm, system, and webapp status?


I have seen several Java web application projects adding some JSP or servlet to visualize status information such as:

  • JVM info (version, free memory, PermGen statistics, etc.)
  • System status (OS, username, system time, locale, encoding, environment variables, etc.)
  • App status (custom...)

Do you know if there is any interesting reusable code that one could add to his/her web projects?

If there is any open-source project out there, we could use it and also contribute with more features (i.e. in our case we'd love also to retrieve the Spring context to generate a report about each bean's configuration).

Thanks,


Solution

  • JavaMelody is a great open source library that will accomplish most of what you are asking for with only a few config lines in your web.xml file. It provides current and historic info of system resources, application configuration, and hit counts and time spent on jsp pages, http requests, sql queries, ehcache etc. It shows current threads, requests, sessions, and error summaries. You can probably extend it to add spring configuration information.

    JaMon was another one I tried, but it was not as easy to drop in as JavaMelody and didn't provide as much information. JavaMelody is built much better than it. I was able to drop it in and be monitoring everything in 5 minutes. I only had to add one more Hibernate config add in order to monitor all my sql queries and then I was done. It's quite a gem and I think you'll find it to be extremely helpful. I've observed that it's overhead is very minimal and can be used in production environments.