LoggingStatisticCollector implements RuntimeStatisticsCollector, StatisticsCollectorMXBean { public String print() { final Map<String, StatSet> localMap = map; final StringBuilder sb = new StringBuilder(1024); final List<StatSet> list = new ArrayList<LoggingStatisticCollector.StatSet>(localMap.values()); Collections.sort(list, new Comparator<StatSet>() { @Override public int compare(StatSet o1, StatSet o2) { return o1.mpId.compareToIgnoreCase(o2.mpId); } }); for (StatSet ss : list) { sb.append(toString(ss)); sb.append("\n"); } if (sb.length() > 0) { sb.deleteCharAt(sb.length() - 1); } return sb.toString(); }  void setLoggingIntervalSec(int loggingIntervalSec); void setResetAfterLogging(boolean resetAfterLogging); synchronized void start(); synchronized void shutdown(); @Override void submit(String measurePointId, int elementCount, long elapsedTime, TimeUnit timeUnit); String print(); String print(String mpId); void reset(); @Override List<MeasurePointData> queryAll(); @Override MeasurePointData query(String measurePointId); Filter getDataFilter(); void setDataFilter(Filter dataFilter);  }
@Test public final void testPrint() { LoggingStatisticCollector collector = new LoggingStatisticCollector(); collector.submit("insertIntoA", 100, 20, TimeUnit.MILLISECONDS); collector.submit("insertIntoA", 101, 21, TimeUnit.MILLISECONDS); collector.submit("insertIntoA", 102, 22, TimeUnit.MILLISECONDS); collector.submit("insertIntoB45", 102, 0, TimeUnit.MILLISECONDS); String x = collector.print(); logger.debug(x); }