Permalink
Browse files

changed logging in test to log4j

  • Loading branch information...
ceocoder committed May 6, 2011
1 parent 0b3b88b commit 24b5adacd8cd4ebb74439ed913f01f823de0ab22
Showing with 8 additions and 6 deletions.
  1. +8 −6 test/lucandra/cluster/IndexManagerTests.java
@@ -30,11 +30,13 @@
import lucandra.CassandraUtils;
import lucandra.dht.RandomPartitioner;
+import org.apache.log4j.Logger;
import org.junit.BeforeClass;
import org.junit.Test;
public class IndexManagerTests
{
+ private static final Logger logger = Logger.getLogger(IndexManagerTests.class);
static String indexName = String.valueOf(System.nanoTime());
private class TestCassandraIndexManager extends CassandraIndexManager
@@ -109,7 +111,7 @@ public void testCassandraIncrement3()
if (j % 100 == 0)
{
long endTime = System.currentTimeMillis();
- System.err.println(Thread.currentThread().getName() + " id:" + id + ", 100 iterations in "
+ logger.info(Thread.currentThread().getName() + " id:" + id + ", 100 iterations in "
+ (endTime - startTime) / 1000 + " sec");
startTime = endTime;
}
@@ -177,7 +179,7 @@ public void testCassandraIncrement() throws IOException
assertNotNull(id);
- // System.err.println(CassandraIndexManager.getShardFromDocId(id));
+ // logger.info(CassandraIndexManager.getShardFromDocId(id));
AtomicInteger counter = shardStats.get(CassandraIndexManager.getShardFromDocId(id));
if (counter == null)
{
@@ -191,7 +193,7 @@ public void testCassandraIncrement() throws IOException
if (i % 10000 == 0)
{
long endTime = System.currentTimeMillis();
- System.err.println("added:" + id + ", 10k iterations in " + (endTime - startTime) / 1000 + " sec "
+ logger.info("added:" + id + ", 10k iterations in " + (endTime - startTime) / 1000 + " sec "
+ shardStats);
startTime = endTime;
}
@@ -209,7 +211,7 @@ public void testCassandraIncrement() throws IOException
if (i % 10000 == 0)
{
long endTime = System.currentTimeMillis();
- System.err.println("updated:" + id + ", 10k iterations in " + (endTime - startTime) / 1000 + " sec");
+ logger.info("updated:" + id + ", 10k iterations in " + (endTime - startTime) / 1000 + " sec");
startTime = endTime;
}
@@ -266,7 +268,7 @@ public void testCassandraIncrement2() throws Exception
}
long endTime = System.currentTimeMillis();
- System.err.println(Thread.currentThread().getName() + " id:" + id + ", 10k iterations in "
+ logger.info(Thread.currentThread().getName() + " id:" + id + ", 10k iterations in "
+ (endTime - startTime) / 1000 + " sec");
startTime = endTime;
}
@@ -292,7 +294,7 @@ public void testCassandraIncrement2() throws Exception
{
if (!all.add(id))
{
- System.err.println(id + " already exists " + all.size());
+ logger.error(id + " already exists " + all.size());
hasError = true;
}
}

0 comments on commit 24b5ada

Please sign in to comment.