You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2012/04/11 20:26:43 UTC
[14/21] git commit: add log4j properties
add log4j properties
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7321adf4
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7321adf4
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7321adf4
Branch: refs/heads/cassandra-1.1.0
Commit: 7321adf4326381ab7ce89346dbd0703a56af0c4e
Parents: fd3bfac
Author: Jonathan Ellis <jb...@apache.org>
Authored: Tue Apr 10 15:58:00 2012 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Wed Apr 11 13:24:32 2012 -0500
----------------------------------------------------------------------
examples/hadoop_word_count/README.txt | 13 +++++++++++++
examples/hadoop_word_count/bin/word_count | 1 +
examples/hadoop_word_count/conf/log4j.properties | 15 +++++++++++++++
examples/hadoop_word_count/src/WordCount.java | 3 ++-
4 files changed, 31 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/7321adf4/examples/hadoop_word_count/README.txt
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/README.txt b/examples/hadoop_word_count/README.txt
index 1ec13f7..cf8a344 100644
--- a/examples/hadoop_word_count/README.txt
+++ b/examples/hadoop_word_count/README.txt
@@ -1,9 +1,16 @@
+Introduction
+============
+
WordCount hadoop example: Inserts a bunch of words across multiple rows,
and counts them, with RandomPartitioner. The word_count_counters example sums
the value of counter columns for a key.
The scripts in bin/ assume you are running with cwd of contrib/word_count.
+
+Running
+=======
+
First build and start a Cassandra server with the default configuration*,
then run
@@ -32,3 +39,9 @@ is written to a text file in /tmp/word_count_counters.
*If you want to point wordcount at a real cluster, modify the seed
and listenaddress settings accordingly.
+
+
+Troubleshooting
+===============
+
+word_count uses conf/log4j.properties to log to wc.out.
http://git-wip-us.apache.org/repos/asf/cassandra/blob/7321adf4/examples/hadoop_word_count/bin/word_count
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/bin/word_count b/examples/hadoop_word_count/bin/word_count
index 58f325e..a0c5aa0 100755
--- a/examples/hadoop_word_count/bin/word_count
+++ b/examples/hadoop_word_count/bin/word_count
@@ -30,6 +30,7 @@ if [ ! -e $cwd/../build/word_count.jar ]; then
exit 1
fi
+CLASSPATH=$CLASSPATH:$cwd/../conf
CLASSPATH=$CLASSPATH:$cwd/../build/word_count.jar
CLASSPATH=$CLASSPATH:$cwd/../../../build/classes/main
CLASSPATH=$CLASSPATH:$cwd/../../../build/classes/thrift
http://git-wip-us.apache.org/repos/asf/cassandra/blob/7321adf4/examples/hadoop_word_count/conf/log4j.properties
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/conf/log4j.properties b/examples/hadoop_word_count/conf/log4j.properties
new file mode 100644
index 0000000..070d21e
--- /dev/null
+++ b/examples/hadoop_word_count/conf/log4j.properties
@@ -0,0 +1,15 @@
+log4j.rootLogger=DEBUG,stdout,F
+
+#stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%5p %d{HH:mm:ss,SSS} %m%n
+
+# log file
+log4j.appender.F=org.apache.log4j.FileAppender
+log4j.appender.F.Append=false
+log4j.appender.F.layout=org.apache.log4j.PatternLayout
+log4j.appender.F.layout.ConversionPattern=%5p [%t] %d{ISO8601} %F (line %L) %m%n
+# Edit the next line to point to your logs directory
+log4j.appender.F.File=wc.out
+
http://git-wip-us.apache.org/repos/asf/cassandra/blob/7321adf4/examples/hadoop_word_count/src/WordCount.java
----------------------------------------------------------------------
diff --git a/examples/hadoop_word_count/src/WordCount.java b/examples/hadoop_word_count/src/WordCount.java
index d3cee0e..96bcb1b 100644
--- a/examples/hadoop_word_count/src/WordCount.java
+++ b/examples/hadoop_word_count/src/WordCount.java
@@ -93,7 +93,8 @@ public class WordCount extends Configured implements Tool
else
value = ByteBufferUtil.string(column.value());
- System.err.println("read " + ByteBufferUtil.string(key) + ":" +name + ":" + value + " from " + context.getInputSplit());
+ logger.debug("read {}:{}={} from {}",
+ new Object[] {ByteBufferUtil.string(key), name, value, context.getInputSplit()});
StringTokenizer itr = new StringTokenizer(value);
while (itr.hasMoreTokens())