Query Debugging

You can debug a specific query at the query level by adding the <trace> keyword before the query string that you want to debug. Here is an example:
<trace> select * from /exampleRegion
You can also write:
<TRACE> select * from /exampleRegion
When the query is executed, GemFire will log a message in $GEMFIRE_DIR/system.log with the following information:
[info 2011/08/29 11:24:35.472 PDT CqServer <main> tid=0x1] Query Executed in 9.619656 ms; rowCount = 99; indexesUsed(0) "select *  from /exampleRegion" 
If you want to enable debugging for all queries, you can enable query execution logging by setting a System property on the command line during start-up:
cacheserver start –J-Dgemfire.Query.VERBOSE=true
Or you can set the property programmatically:
As an example, let us say you have an EmployeeRegion that that contains Employee objects as values and the objects have public fields in them like ID and status.
Class Employee {
 public int ID;
 public String status;
 - - - - - -
 - - - - - -
In addition, you have created the following indexes for the region:
<index name="sampleIndex-1">
<functional from-clause="/test " expression="ID"/>
<index name="sampleIndex-2">
<functional from-clause="/test " expression="status"/>
After you have set gemfire.Query.VERBOSE to "true", you could see the following debug messages in the logs after running queries on the EmployeeRegion or its indexes:
In above log messages, the following information is provided: