add log4j properties

This commit is contained in:
Jonathan Ellis 2012-04-10 15:58:00 -05:00
parent fd3bfac6cb
commit 7321adf432
4 changed files with 31 additions and 1 deletions

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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())