There are many tools for monitoring applications. One that we may want to use is JAMon, the Java Application Monitor; it can be really useful for discovering what the hell is going on in our application. We are going to view a quick introduce in it.

But first, a little words about JAMon.


I think that’s not the
JAMon I’m talking about…

This tool can be used to monitor applications in production, testing or Q & A phases. With JAMon it is possible …

  • … to ensure the application meets its performance requirements.
  • … to ensure the application meets its scalability requirements.
  • … to detect if the application has any errors or throws unwanted exceptions.
  • … to ensure that that all parts of the application were properly tested (coverage).
  • … to ensure that the application is properly working in production as part of post-production testing.
  • … to gather information from production and start a feedback loop between development, test and production that will improve the application

In this post we are going to see how to use JAMon to monitor the queries that Liferay executes, in a really easy way. We are going to use Liferay 6.1, Tomcat, MySQL and JAMon 2.74, but it is really similar with other versions.

Follow these steps:

  1. Download the last version of JAMon.
  2. Unzip and copy
    • jamon.war into tomcatwebapps
    • jamon-2.74.jar into tomcatlibext
  3. Modify portal-ext.propertiesreplace

    Please note that we are using the schema “demo” in localhost
  4. Start Tomcat
  5. Go to http://localhost:8080. You will be able to login, see pages, etc. as usual.
  6. Go to http://localhost:8080/jamon. You will see a page like this:

We are going to ignore all the options except SQL details page. In this section, we are going to be able to view every executed SQL, the start time, execution time, etc.

Also, is possible to use JAMon to detect if the application has any errors or throws unwanted exceptions. If the JAMon JDBC driver is used, all SQL exceptions will show up in the JAMon reports regardless if the exceptions are re-thrown or not.

Note that JAMon allows ANY vendors JDBC driver to be monitored (Sybase, SQL Server, Oracle, MySQL, HSQLDB, etc), and the JAMon JDBC driver allows developers to monitor JDBC/SQL without changing any code.

Share This