@Test
  public void testTraceOnLocalRegionWithTracePrefix() throws Exception {

    String slComment = "-- single line comment with TRACE \n";
    String mlComment =
        " /* Multi-line comments here" + "* ends here " + "* with TRACE too" + "*/ <TRACE> ";
    String prefix = slComment + mlComment;

    // Create Partition Region
    AttributesFactory af = new AttributesFactory();
    af.setScope(Scope.LOCAL);

    region = CacheUtils.createRegion("portfolio", af.create(), false);
    if (region.size() == 0) {
      for (int i = 1; i <= 100; i++) {
        region.put(Integer.toString(i), new Portfolio(i, i));
      }
    }
    assertEquals(100, region.size());
    qs = CacheUtils.getQueryService();

    keyIndex1 =
        qs.createIndex(INDEX_NAME, IndexType.FUNCTIONAL, "ID",
            SEPARATOR + "portfolio ");

    assertTrue(keyIndex1 instanceof CompactRangeIndex);

    Query query = qs.newQuery(prefix + queryStr);
    assertTrue(((DefaultQuery) query).isTraced());

    SelectResults results = (SelectResults) query.execute();
    assertTrue(QueryObserverHolder.getInstance() instanceof IndexTrackingQueryObserver);
    // The query should return all elements in region.
    assertEquals(region.size(), results.size());
    QueryObserverHolder.reset();
  }
Tests tracing on queries with <TRACE> or <trace> tag.
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/QueryTraceJUnitTest.java