martes, 12 de junio de 2012

Queries Logging

Want to know which queries are run and how log did they take individually?
What about enabling the log for jackrabbit? If we enalbe it, it will tell us something like this.

org.apache.jackrabbit.core.query.QueryImpl: executed in 0.00 s. (select * from mgnl:user where jcr:path = '/system/superuser' or jcr:path like '/system/%/superuser')

There are two ways, easiest and does not need restart of the server:
You have to go to menu Tools, logging and there set the value for the query class to DEBUG

Second way is to extend the log4j.xml file so it logs the queries, good thing about this is that you can make it write the queries in a new file, also, the change wont be lost when you restart the server, but, you will need to restart the server in order to see the new logging output.

Note that my log4j.xml is in webapp/WEB-INF/config/default/log4j.xml