Revision: 4269
http://bigdata.svn.sourceforge.net/bigdata/?rev=4269&view=rev
Author: thompsonbry
Date: 2011-03-03 21:32:03 +0000 (Thu, 03 Mar 2011)
Log Message:
-----------
QueryLog is now willing to return a formatted StringBuilder so you can log to the console, etc.
Modified Paths:
--------------
branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/QueryLog.java
Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/QueryLog.java
===================================================================
--- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/QueryLog.java 2011-03-03 21:31:26 UTC (rev 4268)
+++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/bop/engine/QueryLog.java 2011-03-03 21:32:03 UTC (rev 4269)
@@ -75,12 +75,16 @@
static public void log(final IRunningQuery q) {
if (log.isInfoEnabled()) {
-
+
try {
- logDetailRows(q);
+ final StringBuilder sb = new StringBuilder(1024);
+
+ logDetailRows(q,sb);
- logSummaryRow(q);
+ logSummaryRow(q,sb);
+
+ log.info(sb);
} catch (RuntimeException t) {
@@ -93,9 +97,33 @@
}
/**
+ * Log the query.
+ *
+ * @param q
+ * The query.
+ * @param sb
+ * Where to write the log message.
+ */
+ static public void log(final boolean includeTableHeader,
+ final IRunningQuery q, final StringBuilder sb) {
+
+ if(includeTableHeader) {
+
+ sb.append(getTableHeader());
+
+ }
+
+ logDetailRows(q, sb);
+
+ logSummaryRow(q, sb);
+
+ }
+
+ /**
* Log a detail row for each operator in the query.
*/
- static private void logDetailRows(final IRunningQuery q) {
+ static private void logDetailRows(final IRunningQuery q,
+ final StringBuilder sb) {
final Integer[] order = BOpUtility.getEvaluationOrder(q.getQuery());
@@ -103,8 +131,10 @@
for (Integer bopId : order) {
- log.info(getTableRow(q, orderIndex, bopId, false/* summary */));
+ sb.append(getTableRow(q, orderIndex, bopId, false/* summary */));
+// sb.append('\n');
+
orderIndex++;
}
@@ -114,9 +144,11 @@
/**
* Log a summary row for the query.
*/
- static private void logSummaryRow(final IRunningQuery q) {
+ static private void logSummaryRow(final IRunningQuery q, final StringBuilder sb) {
- log.info(getTableRow(q, -1/* orderIndex */, q.getQuery().getId(), true/* summary */));
+ sb.append(getTableRow(q, -1/* orderIndex */, q.getQuery().getId(), true/* summary */));
+
+// sb.append('\n');
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|