Home Liferay Database Query Monitor “P6SPY” Installation In Liferay

Database Query Monitor “P6SPY” Installation In Liferay

This tutorial is for the backend developer for Liferay.
Developers are often comes at the situations where they have to debug the Database Queries. But certain times console SQL or Hibernate SQL are not very help as they are not exact.

As per experts and my personal experience, P6SPY is the perfect solution to monitor the exact queries which are being executed in Liferay Operations.

It is really simple to setup database query monitor in Liferay Environment.
Just follow the below steps and you are done.

  • Edit setenv.sh in tomcat bin dir and include -Dp6.home=/{Liferay-HOME}/{Liferay-Tomcat Home}/lib/ext in JAVA_OPTS

JAVA_OPTS=”$JAVA_OPTS -Dp6.home=/{Liferay-HOME}/{Liferay-Tomcat Home}/lib/ext -Dfile.encoding=UTF8 -Duser.timezone=GMT -Xmx1024m -XX:MaxPermSize=256m”


  • Create spy.properties file in tomcat lib/ext dir

Add below lines to the property file:
(In my example I have used mysql, please insert details of your required DB driver)


# Absolute path of log file
logfile = /home/liferay/tomcat/logs/spy.log

  • Copy p6spy.jar to tomcat lib/ext dir
  • In JNDI database resource pool change driver to “com.p6spy.engine.spy.P6SpyDriver”

YOU ARE DONE, now P6SPY is available in your Liferay and you can monitor the DB Queries.

Share!Share on FacebookShare on Google+Share on LinkedInTweet about this on TwitterFlattr the authorDigg thisPin on PinterestEmail this to someoneShare on StumbleUponShare on RedditShare on TumblrBuffer this pagePrint this page
Copyright © 2017 - Scalsys. All Rights Reserved