Apache Nutch is an extensible and scalable web crawler
NUTCH-303 : Make use of the Commons Logging API and use log4j as the default implementation
Jerome Charron13918f716c23
diff --git a/bin/nutch b/bin/nutchindex adf1ce41d..dbd0e1924 100755--- a/bin/nutch+++ b/bin/nutch@@ -121,6 +121,16 @@ done# restore ordinary behaviourunset IFS+# default log directory & file+if [ "$NUTCH_LOG_DIR" = "" ]; then+ NUTCH_LOG_DIR="$NUTCH_HOME/logs"+fi+if [ "$NUTCH_LOGFILE" = "" ]; then+ NUTCH_LOGFILE='nutch.log'+fi+NUTCH_OPTS="$NUTCH_OPTS -Dnutch.log.dir=$NUTCH_LOG_DIR"+NUTCH_OPTS="$NUTCH_OPTS -Dnutch.log.file=$NUTCH_LOGFILE"+# figure out which class to runif [ "$COMMAND" = "crawl" ] ; thenCLASS=org.apache.nutch.crawl.Crawldiff --git a/build.xml b/build.xmlindex b4a69b20e..9fb142406 100644--- a/build.xml+++ b/build.xml@@ -173,6 +173,7 @@</lib><classes dir="${conf.dir}" excludes="**/*.template"/><classes dir="${web.src.dir}/locale"/>+ <classes file="${web.src.dir}/log4j.properties"/><zipfileset prefix="WEB-INF/classes/plugins" dir="${build.plugins}"/><webinf dir="${lib.dir}"><include name="taglibs-*.tld"/>diff --git a/conf/log4j.properties b/conf/log4j.propertiesnew file mode 100644index 000000000..0cef7a9e0--- /dev/null+++ b/conf/log4j.properties@@ -0,0 +1,54 @@+# RootLogger - DailyRollingFileAppender+log4j.rootLogger=INFO,DRFA++# Logging Threshold+log4j.threshhold=ALL++log4j.logger.org.apache.nutch=INFO+log4j.logger.org.apache.hadoop=WARN++#+# Daily Rolling File Appender+#++log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender+log4j.appender.DRFA.File=${nutch.log.dir}/${nutch.log.file}++# Rollver at midnight+log4j.appender.DRFA.DatePattern=.yyyy-MM-dd++# 30-day backup+#log4j.appender.DRFA.MaxBackupIndex=30+log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout++# Pattern format: Date LogLevel LoggerName LogMessage+log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n+# Debugging Pattern format: Date LogLevel LoggerName (FileName:MethodName:LineNo) LogMessage+#log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n+++#+# stdout+# Add *stdout* to rootlogger above if you want to use this+#++log4j.appender.stdout=org.apache.log4j.ConsoleAppender+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n+++#+# Rolling File Appender+#++#log4j.appender.RFA=org.apache.log4j.RollingFileAppender+#log4j.appender.RFA.File=${hadoop.log.dir}/${hadoop.log.file}++# Logfile size and and 30-day backups+#log4j.appender.RFA.MaxFileSize=1MB+#log4j.appender.RFA.MaxBackupIndex=30++#log4j.appender.RFA.layout=org.apache.log4j.PatternLayout+#log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} - %m%n+#log4j.appender.RFA.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%n+diff --git a/src/java/org/apache/nutch/analysis/AnalyzerFactory.java b/src/java/org/apache/nutch/analysis/AnalyzerFactory.javaindex ccc60bf59..fba6c4002 100644--- a/src/java/org/apache/nutch/analysis/AnalyzerFactory.java+++ b/src/java/org/apache/nutch/analysis/AnalyzerFactory.java@@ -15,15 +15,15 @@*/package org.apache.nutch.analysis;-// JDK imports-import java.util.logging.Logger;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;// Nutch importsimport org.apache.nutch.plugin.Extension;import org.apache.nutch.plugin.ExtensionPoint;import org.apache.nutch.plugin.PluginRuntimeException;import org.apache.nutch.plugin.PluginRepository;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;@@ -36,7 +36,7 @@ public class AnalyzerFactory {private final static String KEY = AnalyzerFactory.class.getName();- public final static Logger LOG = LogFormatter.getLogger(KEY);+ public final static Log LOG = LogFactory.getLog(KEY);private NutchAnalyzer DEFAULT_ANALYZER;diff --git a/src/java/org/apache/nutch/analysis/CommonGrams.java b/src/java/org/apache/nutch/analysis/CommonGrams.javaindex 89bb93105..cec8ec4d8 100644--- a/src/java/org/apache/nutch/analysis/CommonGrams.java+++ b/src/java/org/apache/nutch/analysis/CommonGrams.java@@ -22,10 +22,12 @@ import org.apache.lucene.analysis.Token;import java.io.*;import java.util.*;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.util.NutchConfiguration;import org.apache.nutch.searcher.Query.*;@@ -34,8 +36,7 @@ import org.apache.nutch.searcher.Query.*;* too, with n-grams overlaid. This is achieved through the use of {@link* Token#setPositionIncrement(int)}.*/public class CommonGrams {- private static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.analysis.CommonGrams");+ private static final Log LOG = LogFactory.getLog(CommonGrams.class);private static final char SEPARATOR = '-';/** The key used to cache commonTerms in Configuration */private static final String KEY = CommonGrams.class.getName();@@ -156,13 +157,13 @@ public class CommonGrams {TokenStream ts = new NutchDocumentTokenizer(new StringReader(line));Token token = ts.next();if (token == null) {- LOG.warning("Line does not contain a field name: " + line);+ LOG.warn("Line does not contain a field name: " + line);continue;}String field = token.termText();token = ts.next();if (token == null) {- LOG.warning("Line contains only a field name, no word: " + line);+ LOG.warn("Line contains only a field name, no word: " + line);continue;}String gram = token.termText();diff --git a/src/java/org/apache/nutch/clustering/OnlineClustererFactory.java b/src/java/org/apache/nutch/clustering/OnlineClustererFactory.javaindex e9ba68ca6..4e14ae350 100644--- a/src/java/org/apache/nutch/clustering/OnlineClustererFactory.java+++ b/src/java/org/apache/nutch/clustering/OnlineClustererFactory.java@@ -16,10 +16,12 @@package org.apache.nutch.clustering;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.nutch.plugin.*;import org.apache.hadoop.conf.Configuration;-import java.util.logging.Logger;-import org.apache.hadoop.util.LogFormatter;/*** A factory for retrieving {@link OnlineClusterer} extensions.@@ -28,8 +30,7 @@ import org.apache.hadoop.util.LogFormatter;* @version $Id: OnlineClustererFactory.java,v 1.2 2005/02/07 19:09:26 cutting Exp $*/public class OnlineClustererFactory {- public static final Logger LOG = LogFormatter- .getLogger(OnlineClustererFactory.class.getName());+ public static final Log LOG = LogFactory.getLog(OnlineClustererFactory.class);/*** Nutch configuration key specifying a particular clustering extension@@ -78,8 +79,8 @@ public class OnlineClustererFactory {LOG.info("Using clustering extension: " + extensionName);return (OnlineClusterer) extension.getExtensionInstance();}- LOG.warning("Clustering extension not found: '" + extensionName- + "', trying the default");+ LOG.warn("Clustering extension not found: '" + extensionName+ + "', trying the default");// not found, fallback to the default, if available.}diff --git a/src/java/org/apache/nutch/crawl/Crawl.java b/src/java/org/apache/nutch/crawl/Crawl.javaindex b668db84c..07c217723 100644--- a/src/java/org/apache/nutch/crawl/Crawl.java+++ b/src/java/org/apache/nutch/crawl/Crawl.java@@ -18,12 +18,14 @@ package org.apache.nutch.crawl;import java.util.*;import java.text.*;-import java.util.logging.*;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.nutch.fetcher.Fetcher;import org.apache.hadoop.fs.*;import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.mapred.*;import org.apache.nutch.parse.ParseSegment;import org.apache.nutch.indexer.DeleteDuplicates;@@ -33,8 +35,7 @@ import org.apache.nutch.util.NutchConfiguration;import org.apache.nutch.util.NutchJob;public class Crawl {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.crawl.Crawl");+ public static final Log LOG = LogFactory.getLog(Crawl.class);private static String getDate() {return new SimpleDateFormat("yyyyMMddHHmmss").formatdiff --git a/src/java/org/apache/nutch/crawl/CrawlDb.java b/src/java/org/apache/nutch/crawl/CrawlDb.javaindex 92c334c41..b2c4badc3 100644--- a/src/java/org/apache/nutch/crawl/CrawlDb.java+++ b/src/java/org/apache/nutch/crawl/CrawlDb.java@@ -18,12 +18,14 @@ package org.apache.nutch.crawl;import java.io.*;import java.util.*;-import java.util.logging.*;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.io.*;import org.apache.hadoop.fs.*;import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.mapred.*;import org.apache.nutch.util.NutchConfiguration;@@ -33,8 +35,7 @@ import org.apache.nutch.util.NutchJob;* crawled. Useful for bootstrapping the system. */public class CrawlDb extends Configured {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.crawl.CrawlDb");+ public static final Log LOG = LogFactory.getLog(CrawlDb.class);/** Construct an CrawlDb. */public CrawlDb(Configuration conf) {diff --git a/src/java/org/apache/nutch/crawl/CrawlDbMerger.java b/src/java/org/apache/nutch/crawl/CrawlDbMerger.javaindex 9ae116d41..336e55208 100644--- a/src/java/org/apache/nutch/crawl/CrawlDbMerger.java+++ b/src/java/org/apache/nutch/crawl/CrawlDbMerger.java@@ -18,7 +18,10 @@ package org.apache.nutch.crawl;import java.io.IOException;import java.util.*;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.conf.Configured;@@ -47,7 +50,7 @@ import org.apache.nutch.util.NutchJob;* @author Andrzej Bialecki*/public class CrawlDbMerger extends Configured {- private static final Logger LOG = Logger.getLogger(CrawlDbMerger.class.getName());+ private static final Log LOG = LogFactory.getLog(CrawlDbMerger.class);public static class Merger extends MapReduceBase implements Reducer {private URLFilters filters = null;@@ -67,7 +70,7 @@ public class CrawlDbMerger extends Configured {if (filters.filter(((UTF8) key).toString()) == null)return;} catch (Exception e) {- LOG.fine("Can't filter " + key + ": " + e);+ LOG.debug("Can't filter " + key + ": " + e);}}CrawlDatum res = null;diff --git a/src/java/org/apache/nutch/crawl/CrawlDbReader.java b/src/java/org/apache/nutch/crawl/CrawlDbReader.javaindex efe8d8153..64ccc5230 100644--- a/src/java/org/apache/nutch/crawl/CrawlDbReader.java+++ b/src/java/org/apache/nutch/crawl/CrawlDbReader.java@@ -20,7 +20,10 @@ import java.io.IOException;import java.util.Iterator;import java.util.Random;import java.util.TreeMap;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.fs.FileSystem;@@ -46,7 +49,6 @@ import org.apache.hadoop.mapred.TextOutputFormat;import org.apache.hadoop.mapred.lib.HashPartitioner;import org.apache.hadoop.mapred.lib.IdentityMapper;import org.apache.hadoop.mapred.lib.IdentityReducer;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.util.NutchConfiguration;import org.apache.nutch.util.NutchJob;@@ -58,7 +60,7 @@ import org.apache.nutch.util.NutchJob;*/public class CrawlDbReader implements Closeable {- public static final Logger LOG = LogFormatter.getLogger(CrawlDbReader.class.getName());+ public static final Log LOG = LogFactory.getLog(CrawlDbReader.class);private MapFile.Reader[] readers = null;diff --git a/src/java/org/apache/nutch/crawl/CrawlDbReducer.java b/src/java/org/apache/nutch/crawl/CrawlDbReducer.javaindex 1ed010d21..a4e5bca6d 100644--- a/src/java/org/apache/nutch/crawl/CrawlDbReducer.java+++ b/src/java/org/apache/nutch/crawl/CrawlDbReducer.java@@ -20,18 +20,18 @@ import java.util.ArrayList;import java.util.Iterator;import java.io.IOException;-import java.util.logging.*;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.io.*;import org.apache.hadoop.mapred.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.scoring.ScoringFilterException;import org.apache.nutch.scoring.ScoringFilters;/** Merge new page entries with existing entries. */public class CrawlDbReducer implements Reducer {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.crawl.CrawlDbReducer");+ public static final Log LOG = LogFactory.getLog(CrawlDbReducer.class);private int retryMax;private CrawlDatum result = new CrawlDatum();private ArrayList linked = new ArrayList();@@ -108,8 +108,8 @@ public class CrawlDbReducer implements Reducer {try {scfilters.initialScore((UTF8)key, result);} catch (ScoringFilterException e) {- LOG.warning("Cannot filter init score for url " + key +- ", using default: " + e.getMessage());+ LOG.warn("Cannot filter init score for url " + key ++ ", using default: " + e.getMessage());result.setScore(scoreInjected);}}@@ -122,7 +122,7 @@ public class CrawlDbReducer implements Reducer {break;case CrawlDatum.STATUS_SIGNATURE:- LOG.warning("Lone CrawlDatum.STATUS_SIGNATURE: " + key);+ LOG.warn("Lone CrawlDatum.STATUS_SIGNATURE: " + key);return;case CrawlDatum.STATUS_FETCH_RETRY: // temporary failureif (old != null)@@ -147,7 +147,7 @@ public class CrawlDbReducer implements Reducer {try {scfilters.updateDbScore((UTF8)key, result, linked);} catch (Exception e) {- LOG.warning("Couldn't update score, key=" + key + ": " + e);+ LOG.warn("Couldn't update score, key=" + key + ": " + e);}output.collect(key, result);}diff --git a/src/java/org/apache/nutch/crawl/Generator.java b/src/java/org/apache/nutch/crawl/Generator.javaindex 87235753b..f064cb8b4 100644--- a/src/java/org/apache/nutch/crawl/Generator.java+++ b/src/java/org/apache/nutch/crawl/Generator.java@@ -20,11 +20,13 @@ import java.io.*;import java.net.*;import java.util.*;import java.text.*;-import java.util.logging.*;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.io.*;import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.mapred.*;import org.apache.hadoop.fs.Path;@@ -38,8 +40,7 @@ import org.apache.nutch.util.NutchJob;/** Generates a subset of a crawl db to fetch. */public class Generator extends Configured {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.crawl.Generator");+ public static final Log LOG = LogFactory.getLog(Generator.class);public static class SelectorEntry implements Writable {public UTF8 url;@@ -97,7 +98,7 @@ public class Generator extends Configured {if (filters.filter(url.toString()) == null)return;} catch (URLFilterException e) {- LOG.warning("Couldn't filter url: " + url + " (" + e.getMessage() + ")");+ LOG.warn("Couldn't filter url: " + url + " (" + e.getMessage() + ")");}CrawlDatum crawlDatum = (CrawlDatum)value;@@ -111,7 +112,7 @@ public class Generator extends Configured {try {sort = scfilters.generatorSortValue((UTF8)key, crawlDatum, sort);} catch (ScoringFilterException sfe) {- LOG.warning("Couldn't filter generatorSortValue for " + key + ": " + sfe);+ LOG.warn("Couldn't filter generatorSortValue for " + key + ": " + sfe);}// sort by decreasing scoresortValue.set(sort);@@ -149,9 +150,9 @@ public class Generator extends Configured {InetAddress ia = InetAddress.getByName(host);host = ia.getHostAddress();} catch (UnknownHostException uhe) {- LOG.fine("DNS lookup failed: " + host + ", skipping.");+ LOG.debug("DNS lookup failed: " + host + ", skipping.");dnsFailure++;- if (dnsFailure % 1000 == 0) LOG.warning("DNS failures: " + dnsFailure);+ if (dnsFailure % 1000 == 0) LOG.warn("DNS failures: " + dnsFailure);continue;}}diff --git a/src/java/org/apache/nutch/crawl/Injector.java b/src/java/org/apache/nutch/crawl/Injector.javaindex c7f3ac978..3050c1f85 100644--- a/src/java/org/apache/nutch/crawl/Injector.java+++ b/src/java/org/apache/nutch/crawl/Injector.java@@ -18,12 +18,14 @@ package org.apache.nutch.crawl;import java.io.*;import java.util.*;-import java.util.logging.*;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.io.*;import org.apache.hadoop.fs.*;import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.mapred.*;import org.apache.nutch.net.*;@@ -35,8 +37,7 @@ import org.apache.nutch.util.NutchJob;/** This class takes a flat file of URLs and adds them to the of pages to be* crawled. Useful for bootstrapping the system. */public class Injector extends Configured {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.crawl.Injector");+ public static final Log LOG = LogFactory.getLog(Injector.class);/** Normalize and filter injected urls. */@@ -69,7 +70,7 @@ public class Injector extends Configured {url = urlNormalizer.normalize(url); // normalize the urlurl = filters.filter(url); // filter the url} catch (Exception e) {- LOG.warning("Skipping " +url+":"+e);+ LOG.warn("Skipping " +url+":"+e);url = null;}if (url != null) { // if it passes@@ -79,8 +80,8 @@ public class Injector extends Configured {try {scfilters.initialScore(value, datum);} catch (ScoringFilterException e) {- LOG.warning("Cannot filter init score for url " + url +- ", using default (" + e.getMessage() + ")");+ LOG.warn("Cannot filter init score for url " + url ++ ", using default (" + e.getMessage() + ")");datum.setScore(scoreInjected);}output.collect(value, datum);diff --git a/src/java/org/apache/nutch/crawl/LinkDb.java b/src/java/org/apache/nutch/crawl/LinkDb.javaindex 0b7c25ce4..e77d7293d 100644--- a/src/java/org/apache/nutch/crawl/LinkDb.java+++ b/src/java/org/apache/nutch/crawl/LinkDb.java@@ -18,14 +18,16 @@ package org.apache.nutch.crawl;import java.io.*;import java.util.*;-import java.util.logging.*;import java.net.*;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.hadoop.io.*;import org.apache.hadoop.fs.*;import org.apache.hadoop.fs.FileSystem;import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.mapred.*;import org.apache.nutch.net.URLFilters;@@ -36,8 +38,7 @@ import org.apache.nutch.util.NutchJob;/** Maintains an inverted link map, listing incoming links for each url. */public class LinkDb extends Configured implements Mapper, Reducer {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.crawl.LinkDb");+ public static final Log LOG = LogFactory.getLog(LinkDb.class);public static String CURRENT_NAME = "current";@@ -63,7 +64,7 @@ public class LinkDb extends Configured implements Mapper, Reducer {if (filters.filter(((UTF8)key).toString()) == null)return;} catch (Exception e) {- LOG.fine("Can't filter " + key + ": " + e);+ LOG.debug("Can't filter " + key + ": " + e);}}Inlinks inlinks = null;@@ -84,7 +85,7 @@ public class LinkDb extends Configured implements Mapper, Reducer {if (filters.filter(in.getFromUrl()) == null)continue;} catch (Exception e) {- LOG.fine("Can't filter " + key + ": " + e);+ LOG.debug("Can't filter " + key + ": " + e);}}inlinks.add(in);diff --git a/src/java/org/apache/nutch/crawl/LinkDbReader.java b/src/java/org/apache/nutch/crawl/LinkDbReader.javaindex bad45e9fa..2e6219642 100644--- a/src/java/org/apache/nutch/crawl/LinkDbReader.java+++ b/src/java/org/apache/nutch/crawl/LinkDbReader.java@@ -18,22 +18,24 @@ package org.apache.nutch.crawl;import java.io.IOException;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.hadoop.io.*;import org.apache.hadoop.fs.*;import org.apache.hadoop.mapred.*;import org.apache.hadoop.mapred.lib.HashPartitioner;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;import org.apache.nutch.util.NutchConfiguration;import org.apache.nutch.util.NutchJob;import java.util.Iterator;-import java.util.logging.Logger;/** . */public class LinkDbReader implements Closeable {- public static final Logger LOG = LogFormatter.getLogger(LinkDbReader.class.getName());+ public static final Log LOG = LogFactory.getLog(LinkDbReader.class);private static final Partitioner PARTITIONER = new HashPartitioner();diff --git a/src/java/org/apache/nutch/crawl/MapWritable.java b/src/java/org/apache/nutch/crawl/MapWritable.javaindex cc2b7bcab..3fa063906 100644--- a/src/java/org/apache/nutch/crawl/MapWritable.java+++ b/src/java/org/apache/nutch/crawl/MapWritable.java@@ -25,7 +25,10 @@ import java.util.HashSet;import java.util.Iterator;import java.util.LinkedList;import java.util.Set;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.io.BytesWritable;import org.apache.hadoop.io.FloatWritable;@@ -36,7 +39,6 @@ import org.apache.hadoop.io.NullWritable;import org.apache.hadoop.io.ObjectWritable;import org.apache.hadoop.io.UTF8;import org.apache.hadoop.io.Writable;-import org.apache.hadoop.util.LogFormatter;/*** A writable map, with a similar behavior as <code>java.util.HashMap</code>.@@ -52,8 +54,7 @@ import org.apache.hadoop.util.LogFormatter;*/public class MapWritable implements Writable {- public static final Logger LOG = LogFormatter.getLogger(MapWritable.class- .getName());+ public static final Log LOG = LogFactory.getLog(MapWritable.class);private KeyValueEntry fFirst;@@ -312,7 +313,7 @@ public class MapWritable implements Writable {clazz = Class.forName(UTF8.readString(in));addIdEntry(id, clazz);} catch (Exception e) {- LOG.warning("MapWritable: unable to load internal map entry" + e.toString());+ LOG.warn("MapWritable: unable to load internal map entry" + e.toString());fIdCount--;}}@@ -328,8 +329,8 @@ public class MapWritable implements Writable {fLast = fLast.fNextEntry = entry;}} catch (IOException e) {- LOG.warning("MapWritable: unable to load meta data entry, ignoring.. : "- + e.toString());+ LOG.warn("MapWritable: unable to load meta data entry, ignoring.. : "+ + e.toString());fSize--;}}diff --git a/src/java/org/apache/nutch/crawl/SignatureFactory.java b/src/java/org/apache/nutch/crawl/SignatureFactory.javaindex f3b8345a0..ecbe70e1a 100644--- a/src/java/org/apache/nutch/crawl/SignatureFactory.java+++ b/src/java/org/apache/nutch/crawl/SignatureFactory.java@@ -16,9 +16,11 @@package org.apache.nutch.crawl;-import java.util.logging.Logger;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;-import org.apache.hadoop.util.LogFormatter;+// Hadoop importsimport org.apache.hadoop.conf.Configuration;/**@@ -29,8 +31,7 @@ import org.apache.hadoop.conf.Configuration;* @author Andrzej Bialecki <[email protected]>*/public class SignatureFactory {- private static final Logger LOG =- LogFormatter.getLogger(SignatureFactory.class.getName());+ private static final Log LOG = LogFactory.getLog(SignatureFactory.class);private SignatureFactory() {} // no public ctordiff --git a/src/java/org/apache/nutch/fetcher/Fetcher.java b/src/java/org/apache/nutch/fetcher/Fetcher.javaindex e706a4a7b..ed7824aef 100644--- a/src/java/org/apache/nutch/fetcher/Fetcher.java+++ b/src/java/org/apache/nutch/fetcher/Fetcher.java@@ -18,10 +18,13 @@ package org.apache.nutch.fetcher;import java.io.IOException;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.hadoop.io.*;import org.apache.hadoop.fs.*;import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.mapred.*;import org.apache.nutch.crawl.CrawlDatum;@@ -33,13 +36,11 @@ import org.apache.nutch.parse.*;import org.apache.nutch.scoring.ScoringFilters;import org.apache.nutch.util.*;-import java.util.logging.*;/** The fetcher. Most of the work is done by plugins. */public class Fetcher extends Configured implements MapRunnable {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.fetcher.Fetcher");+ public static final Log LOG = LogFactory.getLog(Fetcher.class);public static final String SIGNATURE_KEY = "nutch.content.digest";public static final String SEGMENT_NAME_KEY = "nutch.segment.name";@@ -103,16 +104,19 @@ public class Fetcher extends Configured implements MapRunnable {CrawlDatum datum = new CrawlDatum();while (true) {- if (LogFormatter.hasLoggedSevere()) // something bad happened- break; // exit+ // TODO : NUTCH-258 ...+ // If something bad happened, then exit+ // if (conf.getBoolean("fetcher.exit", false)) {+ // break;+ // ]try { // get next entry from inputif (!input.next(key, datum)) {break; // at eof, exit}} catch (IOException e) {- e.printStackTrace();- LOG.severe("fetcher caught:"+e.toString());+ e.printStackTrace(LogUtil.getFatalStream(LOG));+ LOG.fatal("fetcher caught:"+e.toString());break;}@@ -130,7 +134,7 @@ public class Fetcher extends Configured implements MapRunnable {int redirectCount = 0;do {redirecting = false;- LOG.fine("redirectCount=" + redirectCount);+ LOG.debug("redirectCount=" + redirectCount);Protocol protocol = this.protocolFactory.getProtocol(url.toString());ProtocolOutput output = protocol.getProtocolOutput(url, datum);ProtocolStatus status = output.getStatus();@@ -151,9 +155,9 @@ public class Fetcher extends Configured implements MapRunnable {url = new UTF8(newUrl);redirecting = true;redirectCount++;- LOG.fine(" - content redirect to " + url);+ LOG.debug(" - content redirect to " + url);} else {- LOG.fine(" - content redirect skipped: " ++ LOG.debug(" - content redirect skipped: " +(newUrl != null ? "to same url" : "filtered"));}}@@ -168,9 +172,9 @@ public class Fetcher extends Configured implements MapRunnable {url = new UTF8(newUrl);redirecting = true;redirectCount++;- LOG.fine(" - protocol redirect to " + url);+ LOG.debug(" - protocol redirect to " + url);} else {- LOG.fine(" - protocol redirect skipped: " ++ LOG.debug(" - protocol redirect skipped: " +(newUrl != null ? "to same url" : "filtered"));}break;@@ -191,7 +195,7 @@ public class Fetcher extends Configured implements MapRunnable {break;default:- LOG.warning("Unknown ProtocolStatus: " + status.getCode());+ LOG.warn("Unknown ProtocolStatus: " + status.getCode());output(url, datum, null, CrawlDatum.STATUS_FETCH_GONE);}@@ -211,8 +215,8 @@ public class Fetcher extends Configured implements MapRunnable {}} catch (Throwable e) {- e.printStackTrace();- LOG.severe("fetcher caught:"+e.toString());+ e.printStackTrace(LogUtil.getFatalStream(LOG));+ LOG.fatal("fetcher caught:"+e.toString());} finally {synchronized (Fetcher.this) {activeThreads--;} // count threads}@@ -242,8 +246,8 @@ public class Fetcher extends Configured implements MapRunnable {try {scfilters.passScoreBeforeParsing(key, datum, content);} catch (Exception e) {- e.printStackTrace();- LOG.warning("Couldn't pass score, url " + key + " (" + e + ")");+ e.printStackTrace(LogUtil.getWarnStream(LOG));+ LOG.warn("Couldn't pass score, url " + key + " (" + e + ")");}Parse parse = null;@@ -256,7 +260,7 @@ public class Fetcher extends Configured implements MapRunnable {parseStatus = new ParseStatus(e);}if (!parseStatus.isSuccess()) {- LOG.warning("Error parsing: " + key + ": " + parseStatus);+ LOG.warn("Error parsing: " + key + ": " + parseStatus);parse = parseStatus.getEmptyParse(getConf());}// Calculate page signature. For non-parsing fetchers this will@@ -270,8 +274,8 @@ public class Fetcher extends Configured implements MapRunnable {try {scfilters.passScoreAfterParsing(key, content, parse);} catch (Exception e) {- e.printStackTrace();- LOG.warning("Couldn't pass score, url " + key + " (" + e + ")");+ e.printStackTrace(LogUtil.getWarnStream(LOG));+ LOG.warn("Couldn't pass score, url " + key + " (" + e + ")");}}@@ -283,8 +287,8 @@ public class Fetcher extends Configured implements MapRunnable {storingContent ? content : null,parse != null ? new ParseImpl(parse) : null));} catch (IOException e) {- e.printStackTrace();- LOG.severe("fetcher caught:"+e.toString());+ e.printStackTrace(LogUtil.getFatalStream(LOG));+ LOG.fatal("fetcher caught:"+e.toString());}if (parse != null) return parse.getData().getStatus();else return null;@@ -320,9 +324,9 @@ public class Fetcher extends Configured implements MapRunnable {this.storingContent = isStoringContent(job);this.parsing = isParsing(job);- if (job.getBoolean("fetcher.verbose", false)) {- LOG.setLevel(Level.FINE);- }+// if (job.getBoolean("fetcher.verbose", false)) {+// LOG.setLevel(Level.FINE);+// }}public void close() {}@@ -364,7 +368,7 @@ public class Fetcher extends Configured implements MapRunnable {// some requests seem to hang, despite all intentionssynchronized (this) {if ((System.currentTimeMillis() - lastRequestStart) > timeout) {- LOG.warning("Aborting with "+activeThreads+" hung threads.");+ LOG.warn("Aborting with "+activeThreads+" hung threads.");return;}}diff --git a/src/java/org/apache/nutch/indexer/DeleteDuplicates.java b/src/java/org/apache/nutch/indexer/DeleteDuplicates.javaindex 133e15021..40a9c8d2a 100644--- a/src/java/org/apache/nutch/indexer/DeleteDuplicates.java+++ b/src/java/org/apache/nutch/indexer/DeleteDuplicates.java@@ -18,12 +18,13 @@ package org.apache.nutch.indexer;import java.io.*;import java.util.*;-import java.util.logging.*;++import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.io.*;import org.apache.hadoop.fs.*;import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.mapred.*;import org.apache.nutch.util.NutchConfiguration;@@ -38,8 +39,7 @@ import org.apache.lucene.document.Document;******************************************************************/public class DeleteDuplicates extends Configuredimplements Mapper, Reducer, OutputFormat {- private static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.indexer.DeleteDuplicates");+ private static final Log LOG = LogFactory.getLog(DeleteDuplicates.class);// Algorithm://diff --git a/src/java/org/apache/nutch/indexer/IndexMerger.java b/src/java/org/apache/nutch/indexer/IndexMerger.javaindex fce32d812..02a34d44e 100644--- a/src/java/org/apache/nutch/indexer/IndexMerger.java+++ b/src/java/org/apache/nutch/indexer/IndexMerger.java@@ -18,12 +18,14 @@ package org.apache.nutch.indexer;import java.io.*;import java.util.*;-import java.util.logging.*;++import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.fs.*;import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;+import org.apache.nutch.util.LogUtil;import org.apache.nutch.util.NutchConfiguration;import org.apache.lucene.store.Directory;@@ -37,8 +39,7 @@ import org.apache.lucene.index.IndexWriter;* @author Mike Cafarella*************************************************************************/public class IndexMerger {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.indexer.IndexMerger");+ public static final Log LOG = LogFactory.getLog(IndexMerger.class);public static final String DONE_NAME = "merge.done";@@ -88,7 +89,7 @@ public class IndexMerger {writer.setMaxBufferedDocs(conf.getInt("indexer.minMergeDocs", IndexWriter.DEFAULT_MAX_BUFFERED_DOCS));writer.setMaxMergeDocs(conf.getInt("indexer.maxMergeDocs", IndexWriter.DEFAULT_MAX_MERGE_DOCS));writer.setTermIndexInterval(conf.getInt("indexer.termIndexInterval", IndexWriter.DEFAULT_TERM_INDEX_INTERVAL));- writer.setInfoStream(LogFormatter.getLogStream(LOG, Level.FINE));+ writer.setInfoStream(LogUtil.getDebugStream(LOG));writer.setUseCompoundFile(false);writer.setSimilarity(new NutchSimilarity());writer.addIndexes(dirs);diff --git a/src/java/org/apache/nutch/indexer/Indexer.java b/src/java/org/apache/nutch/indexer/Indexer.javaindex 3caa65c20..3beae5cdc 100644--- a/src/java/org/apache/nutch/indexer/Indexer.java+++ b/src/java/org/apache/nutch/indexer/Indexer.java@@ -18,19 +18,21 @@ package org.apache.nutch.indexer;import java.io.*;import java.util.*;-import java.util.logging.*;++import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.io.*;import org.apache.nutch.fetcher.Fetcher;import org.apache.hadoop.fs.*;import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.mapred.*;import org.apache.nutch.parse.*;import org.apache.nutch.analysis.*;import org.apache.nutch.scoring.ScoringFilterException;import org.apache.nutch.scoring.ScoringFilters;+import org.apache.nutch.util.LogUtil;import org.apache.nutch.util.NutchConfiguration;import org.apache.nutch.util.NutchJob;@@ -47,8 +49,7 @@ public class Indexer extends Configured implements Reducer {public static final String DONE_NAME = "index.done";- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.crawl.Indexer");+ public static final Log LOG = LogFactory.getLog(Indexer.class);/** Wraps inputs in an {@link ObjectWritable}, to permit merging different* types in reduce. */@@ -96,7 +97,7 @@ public class Indexer extends Configured implements Reducer {writer.setTermIndexInterval(job.getInt("indexer.termIndexInterval", 128));writer.setMaxFieldLength(job.getInt("indexer.max.tokens", 10000));- writer.setInfoStream(LogFormatter.getLogStream(LOG, Level.INFO));+ writer.setInfoStream(LogUtil.getInfoStream(LOG));writer.setUseCompoundFile(false);writer.setSimilarity(new NutchSimilarity());@@ -195,7 +196,7 @@ public class Indexer extends Configured implements Reducer {} else if (value instanceof ParseText) {parseText = (ParseText)value;} else {- LOG.warning("Unrecognized type: "+value.getClass());+ LOG.warn("Unrecognized type: "+value.getClass());}}@@ -227,7 +228,7 @@ public class Indexer extends Configured implements Reducer {// run indexing filtersdoc = this.filters.filter(doc, parse, (UTF8)key, fetchDatum, inlinks);} catch (IndexingException e) {- LOG.warning("Error indexing "+key+": "+e);+ LOG.warn("Error indexing "+key+": "+e);return;}@@ -237,7 +238,7 @@ public class Indexer extends Configured implements Reducer {boost = this.scfilters.indexerScore((UTF8)key, doc, dbDatum,fetchDatum, parse, inlinks, boost);} catch (ScoringFilterException e) {- LOG.warning("Error calculating score " + key + ": " + e);+ LOG.warn("Error calculating score " + key + ": " + e);return;}// apply boost to all indexed fields.diff --git a/src/java/org/apache/nutch/indexer/IndexingFilters.java b/src/java/org/apache/nutch/indexer/IndexingFilters.javaindex afef4f04b..e12aa3016 100644--- a/src/java/org/apache/nutch/indexer/IndexingFilters.java+++ b/src/java/org/apache/nutch/indexer/IndexingFilters.java@@ -18,6 +18,10 @@ package org.apache.nutch.indexer;import java.util.HashMap;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.lucene.document.Document;import org.apache.nutch.plugin.*;@@ -30,6 +34,8 @@ import org.apache.hadoop.io.UTF8;/** Creates and caches {@link IndexingFilter} implementing plugins.*/public class IndexingFilters {+ public final static Log LOG = LogFactory.getLog(IndexingFilters.class);+private IndexingFilter[] indexingFilters;public IndexingFilters(Configuration conf) {@@ -44,7 +50,7 @@ public class IndexingFilters {for (int i = 0; i < extensions.length; i++) {Extension extension = extensions[i];IndexingFilter filter = (IndexingFilter) extension.getExtensionInstance();- System.out.println("-adding " + filter.getClass().getName());+ LOG.info("Adding " + filter.getClass().getName());if (!filterMap.containsKey(filter.getClass().getName())) {filterMap.put(filter.getClass().getName(), filter);}diff --git a/src/java/org/apache/nutch/net/BasicUrlNormalizer.java b/src/java/org/apache/nutch/net/BasicUrlNormalizer.javaindex 0e5b7fb8d..33c2d7bb5 100644--- a/src/java/org/apache/nutch/net/BasicUrlNormalizer.java+++ b/src/java/org/apache/nutch/net/BasicUrlNormalizer.java@@ -18,18 +18,20 @@ package org.apache.nutch.net;import java.net.URL;import java.net.MalformedURLException;-// import java.net.URI;-// import java.net.URISyntaxException;-import java.util.logging.Logger;-import org.apache.hadoop.util.LogFormatter;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;++// Nutch imports+import org.apache.nutch.util.LogUtil;+import org.apache.hadoop.conf.Configuration;import org.apache.oro.text.regex.*;/** Converts URLs to a normal form . */public class BasicUrlNormalizer implements UrlNormalizer {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.net.BasicUrlNormalizer");+ public static final Log LOG = LogFactory.getLog(BasicUrlNormalizer.class);private Perl5Compiler compiler = new Perl5Compiler();private ThreadLocal matchers = new ThreadLocal() {@@ -61,7 +63,7 @@ public class BasicUrlNormalizer implements UrlNormalizer {leadingRelativePathRule.substitution = new Perl5Substitution("/");} catch (MalformedPatternException e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));throw new RuntimeException(e);}}diff --git a/src/java/org/apache/nutch/net/RegexUrlNormalizer.java b/src/java/org/apache/nutch/net/RegexUrlNormalizer.javaindex 8926489fc..df7d3e864 100644--- a/src/java/org/apache/nutch/net/RegexUrlNormalizer.java+++ b/src/java/org/apache/nutch/net/RegexUrlNormalizer.java@@ -106,7 +106,7 @@ public class RegexUrlNormalizer extends BasicUrlNormalizer.parse(filename);Element root = doc.getDocumentElement();if (!"regex-normalize".equals(root.getTagName()))- LOG.severe("bad conf file: top-level element not <regex-normalize>");+ LOG.fatal("bad conf file: top-level element not <regex-normalize>");NodeList regexes = root.getChildNodes();for (int i = 0; i < regexes.getLength(); i++) {Node regexNode = regexes.item(i);@@ -114,7 +114,7 @@ public class RegexUrlNormalizer extends BasicUrlNormalizercontinue;Element regex = (Element)regexNode;if (!"regex".equals(regex.getTagName()))- LOG.warning("bad conf file: element not <regex>");+ LOG.warn("bad conf file: element not <regex>");NodeList fields = regex.getChildNodes();String patternValue = null;String subValue = null;@@ -139,7 +139,7 @@ public class RegexUrlNormalizer extends BasicUrlNormalizer}} catch (Exception e) {- LOG.severe("error parsing " + filename +" conf file: " + e);+ LOG.fatal("error parsing " + filename +" conf file: " + e);}return rules;}diff --git a/src/java/org/apache/nutch/net/URLFilterChecker.java b/src/java/org/apache/nutch/net/URLFilterChecker.javaindex 3da7619aa..7e1ac2448 100644--- a/src/java/org/apache/nutch/net/URLFilterChecker.java+++ b/src/java/org/apache/nutch/net/URLFilterChecker.java@@ -20,13 +20,10 @@ import org.apache.nutch.plugin.Extension;import org.apache.nutch.plugin.ExtensionPoint;import org.apache.nutch.plugin.PluginRepository;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;import org.apache.nutch.util.NutchConfiguration;-import java.util.logging.Logger;-import java.io.BufferedReader;import java.io.InputStreamReader;@@ -38,8 +35,6 @@ import java.io.InputStreamReader;public class URLFilterChecker {- public static final Logger LOG =- LogFormatter.getLogger(URLFilterChecker.class.getName());private Configuration conf;public URLFilterChecker(Configuration conf) {@@ -60,7 +55,6 @@ public class URLFilterChecker {for (int i = 0; i < extensions.length; i++) {Extension extension = extensions[i];filter = (URLFilter)extension.getExtensionInstance();- //LOG.info(filter.getClass().getName());if (filter.getClass().getName().equals(filterName)) {break;} else {@@ -71,10 +65,11 @@ public class URLFilterChecker {if (filter == null)throw new RuntimeException("Filter "+filterName+" not found.");- if (LogFormatter.hasLoggedSevere())- throw new RuntimeException("Severe error encountered.");+ // jerome : should we keep this behavior?+ //if (LogFormatter.hasLoggedSevere())+ // throw new RuntimeException("Severe error encountered.");- LOG.info("Checking URLFilter "+filterName);+ System.out.println("Checking URLFilter "+filterName);BufferedReader in = new BufferedReader(new InputStreamReader(System.in));String line;@@ -91,7 +86,7 @@ public class URLFilterChecker {}private void checkAll() throws Exception {- LOG.info("Checking combination of all URLFilters available");+ System.out.println("Checking combination of all URLFilters available");BufferedReader in = new BufferedReader(new InputStreamReader(System.in));String line;diff --git a/src/java/org/apache/nutch/net/UrlNormalizerFactory.java b/src/java/org/apache/nutch/net/UrlNormalizerFactory.javaindex 34a074aa1..b2b72b8d7 100644--- a/src/java/org/apache/nutch/net/UrlNormalizerFactory.java+++ b/src/java/org/apache/nutch/net/UrlNormalizerFactory.java@@ -16,15 +16,16 @@package org.apache.nutch.net;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;-import java.util.logging.*;/** Factory to create a UrlNormalizer from "urlnormalizer.class" config property. */public class UrlNormalizerFactory {- private static final Logger LOG = LogFormatter- .getLogger("org.apache.nutch.net.UrlNormalizerFactory");+ private static final Log LOG = LogFactory.getLog(UrlNormalizerFactory.class);private Configuration conf;diff --git a/src/java/org/apache/nutch/ontology/OntologyFactory.java b/src/java/org/apache/nutch/ontology/OntologyFactory.javaindex 73fdbe971..12e81df4c 100644--- a/src/java/org/apache/nutch/ontology/OntologyFactory.java+++ b/src/java/org/apache/nutch/ontology/OntologyFactory.java@@ -16,10 +16,12 @@package org.apache.nutch.ontology;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.nutch.plugin.*;import org.apache.hadoop.conf.Configuration;-import java.util.logging.Logger;-import org.apache.hadoop.util.LogFormatter;/*** A factory for retrieving {@link Ontology} extensions.@@ -28,8 +30,7 @@ import org.apache.hadoop.util.LogFormatter;* @version $Id: OntologyFactory.java,v 1.2 2005/02/07 19:09:58 cutting Exp $*/public class OntologyFactory {- public final static Logger LOG =- LogFormatter.getLogger(OntologyFactory.class.getName());+ public final static Log LOG = LogFactory.getLog(OntologyFactory.class);private ExtensionPoint extensionPoint;private Configuration conf;@@ -60,8 +61,8 @@ public class OntologyFactory {LOG.info("Using ontology extension: " + extensionName);return (Ontology) extension.getExtensionInstance();}- LOG.warning("Ontology extension not found: '" + extensionName- + "', trying the default");+ LOG.warn("Ontology extension not found: '" + extensionName+ + "', trying the default");// not found, fallback to the default, if available.}diff --git a/src/java/org/apache/nutch/parse/OutlinkExtractor.java b/src/java/org/apache/nutch/parse/OutlinkExtractor.javaindex 9d7e461d9..e265a2217 100644--- a/src/java/org/apache/nutch/parse/OutlinkExtractor.java+++ b/src/java/org/apache/nutch/parse/OutlinkExtractor.java@@ -18,9 +18,10 @@ package org.apache.nutch.parse;import java.util.ArrayList;import java.util.List;-import java.util.logging.Logger;-import org.apache.hadoop.util.LogFormatter;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.hadoop.conf.Configuration;import org.apache.oro.text.regex.MatchResult;import org.apache.oro.text.regex.Pattern;@@ -45,8 +46,7 @@ import org.apache.oro.text.regex.Perl5Matcher;* @since 0.7*/public class OutlinkExtractor {- private static final Logger LOG = LogFormatter- .getLogger(OutlinkExtractor.class.getName());+ private static final Log LOG = LogFactory.getLog(OutlinkExtractor.class);/*** Regex pattern to get URLs within a plain text.@@ -101,7 +101,7 @@ public class OutlinkExtractor {// (SHOULD really check cpu time used so that heavily loaded systems// do not unnecessarily hit this limit.)if (System.currentTimeMillis() - start >= 60000L) {- LOG.warning("Time limit exceeded for getOutLinks");+ LOG.warn("Time limit exceeded for getOutLinks");break;}result = matcher.getMatch();@@ -110,7 +110,7 @@ public class OutlinkExtractor {}} catch (Exception ex) {// if the matcher fails (perhaps a malformed URL) we just log it and move on- LOG.throwing(OutlinkExtractor.class.getName(), "getOutlinks", ex);+ LOG.error("getOutlinks", ex);}final Outlink[] retval;@@ -152,7 +152,7 @@ public class OutlinkExtractor {//// url = re.getParen(0);//- // LOG.finest("Extracted url: " + url);+ // LOG.trace("Extracted url: " + url);//// try {//@@ -162,7 +162,7 @@ public class OutlinkExtractor {// } catch (MalformedURLException ex) {// // if it is a malformed URL we just throw it away and continue with// // extraction.- // LOG.throwing(this.getClass().getName(), "getOutlinks", ex);+ // LOG.error("getOutlinks", ex);// }//// pos = re.getParenEnd(0);@@ -215,7 +215,7 @@ public class OutlinkExtractor {// } catch (MalformedURLException ex) {// // if it is a malformed URL we just throw it away and continue with// // extraction.- // LOG.throwing(this.getClass().getName(), "getOutlinks", ex);+ // LOG.error("getOutlinks", ex);// }//// pos = re.getParenEnd(0);diff --git a/src/java/org/apache/nutch/parse/ParseOutputFormat.java b/src/java/org/apache/nutch/parse/ParseOutputFormat.javaindex 1e5ab1505..a225997d4 100644--- a/src/java/org/apache/nutch/parse/ParseOutputFormat.java+++ b/src/java/org/apache/nutch/parse/ParseOutputFormat.java@@ -16,6 +16,10 @@package org.apache.nutch.parse;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.hadoop.io.*;import org.apache.nutch.crawl.CrawlDatum;import org.apache.nutch.fetcher.Fetcher;@@ -27,11 +31,10 @@ import org.apache.nutch.util.StringUtil;import org.apache.nutch.net.*;import java.io.*;-import java.util.logging.Logger;/* Parse content in a segment. */public class ParseOutputFormat implements OutputFormat {- private static final Logger LOG = Logger.getLogger(ParseOutputFormat.class.getName());+ private static final Log LOG = LogFactory.getLog(ParseOutputFormat.class);private UrlNormalizer urlNormalizer;private URLFilters filters;@@ -116,8 +119,8 @@ public class ParseOutputFormat implements OutputFormat {adjust = scfilters.distributeScoreToOutlink((UTF8)key, targetUrl,parseData, target, null, links.length, validCount);} catch (ScoringFilterException e) {- LOG.warning("Cannot distribute score from " + key + " to " + targetUrl +- " - skipped (" + e.getMessage());+ LOG.warn("Cannot distribute score from " + key + " to " + targetUrl ++ " - skipped (" + e.getMessage());continue;}crawlOut.append(targetUrl, target);diff --git a/src/java/org/apache/nutch/parse/ParsePluginsReader.java b/src/java/org/apache/nutch/parse/ParsePluginsReader.javaindex af05b212b..00a026922 100644--- a/src/java/org/apache/nutch/parse/ParsePluginsReader.java+++ b/src/java/org/apache/nutch/parse/ParsePluginsReader.java@@ -23,7 +23,6 @@ import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;-import java.util.logging.Logger;import javax.xml.parsers.DocumentBuilder;import javax.xml.parsers.DocumentBuilderFactory;@@ -33,9 +32,14 @@ import org.w3c.dom.Element;import org.w3c.dom.NodeList;import org.xml.sax.InputSource;-// Nutch imports-import org.apache.hadoop.util.LogFormatter;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;++// Hadoop importsimport org.apache.hadoop.conf.Configuration;++// Nutch importsimport org.apache.nutch.util.NutchConfiguration;@@ -49,8 +53,7 @@ import org.apache.nutch.util.NutchConfiguration;class ParsePluginsReader {/* our log stream */- public static final Logger LOG =- LogFormatter.getLogger(ParsePluginsReader.class.getName());+ public static final Log LOG = LogFactory.getLog(ParsePluginsReader.class);/** The property name of the parse-plugins location */private static final String PP_FILE_PROP = "parse.plugin.file";@@ -90,8 +93,8 @@ class ParsePluginsReader {parsePluginUrl = new URL(fParsePluginsFile);ppInputStream = parsePluginUrl.openStream();} catch (Exception e) {- LOG.warning("Unable to load parse plugins file from URL " +- "[" + fParsePluginsFile + "]. Reason is [" + e + "]");+ LOG.warn("Unable to load parse plugins file from URL " ++ "[" + fParsePluginsFile + "]. Reason is [" + e + "]");return pList;}} else {@@ -106,8 +109,8 @@ class ParsePluginsReader {parser = factory.newDocumentBuilder();document = parser.parse(inputSource);} catch (Exception e) {- LOG.warning("Unable to parse [" + fParsePluginsFile + "]." +- "Reason is [" + e + "]");+ LOG.warn("Unable to parse [" + fParsePluginsFile + "]." ++ "Reason is [" + e + "]");return null;}@@ -161,8 +164,8 @@ class ParsePluginsReader {pList.setPluginList(mimeTypeStr, plugList);} else {- LOG.warning("ParsePluginsReader:ERROR:no plugins defined for mime type: "- + mimeTypeStr + ", continuing parse");+ LOG.warn("ParsePluginsReader:ERROR:no plugins defined for mime type: "+ + mimeTypeStr + ", continuing parse");}}return pList;@@ -237,13 +240,13 @@ class ParsePluginsReader {NodeList aliasRoot = parsePluginsRoot.getElementsByTagName("aliases");if (aliasRoot == null || (aliasRoot != null && aliasRoot.getLength() == 0)) {- LOG.warning("No aliases defined in parse-plugins.xml!");+ LOG.warn("No aliases defined in parse-plugins.xml!");return aliases;}if (aliasRoot.getLength() > 1) {// log a warning, but try and continue processing- LOG.warning("There should only be one \"aliases\" tag in parse-plugins.xml");+ LOG.warn("There should only be one \"aliases\" tag in parse-plugins.xml");}Element aliasRootElem = (Element)aliasRoot.item(0);@@ -254,8 +257,8 @@ class ParsePluginsReader {Element aliasElem = (Element)aliasElements.item(i);String parsePluginId = aliasElem.getAttribute("name");String extensionId = aliasElem.getAttribute("extension-id");- LOG.finest("Found alias: plugin-id: " + parsePluginId +- ", extension-id: " + extensionId);+ LOG.trace("Found alias: plugin-id: " + parsePluginId ++ ", extension-id: " + extensionId);if (parsePluginId != null && extensionId != null) {aliases.put(parsePluginId, extensionId);}diff --git a/src/java/org/apache/nutch/parse/ParseSegment.java b/src/java/org/apache/nutch/parse/ParseSegment.javaindex c3a83fabb..a4d2ffe22 100644--- a/src/java/org/apache/nutch/parse/ParseSegment.java+++ b/src/java/org/apache/nutch/parse/ParseSegment.java@@ -16,12 +16,14 @@package org.apache.nutch.parse;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.nutch.crawl.SignatureFactory;import org.apache.nutch.fetcher.Fetcher;import org.apache.hadoop.io.*;import org.apache.hadoop.mapred.*;import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.protocol.*;import org.apache.nutch.scoring.ScoringFilterException;import org.apache.nutch.scoring.ScoringFilters;@@ -30,13 +32,11 @@ import org.apache.hadoop.fs.Path;import java.io.*;import java.util.*;-import java.util.logging.*;/* Parse content in a segment. */public class ParseSegment extends Configured implements Mapper, Reducer {- public static final Logger LOG =- LogFormatter.getLogger(Parser.class.getName());+ public static final Log LOG = LogFactory.getLog(Parser.class);private ScoringFilters scfilters;@@ -77,13 +77,13 @@ public class ParseSegment extends Configured implements Mapper, Reducer {try {scfilters.passScoreAfterParsing((UTF8)key, content, parse);} catch (ScoringFilterException e) {- e.printStackTrace();- LOG.warning("Error passing score: "+key+": "+e.getMessage());+ e.printStackTrace(LogUtil.getWarnStream(LOG));+ LOG.warn("Error passing score: "+key+": "+e.getMessage());return;}output.collect(key, new ParseImpl(parse.getText(), parse.getData()));} else {- LOG.warning("Error parsing: "+key+": "+status.toString());+ LOG.warn("Error parsing: "+key+": "+status.toString());}}diff --git a/src/java/org/apache/nutch/parse/ParseUtil.java b/src/java/org/apache/nutch/parse/ParseUtil.javaindex 626e83021..b1132bd6e 100644--- a/src/java/org/apache/nutch/parse/ParseUtil.java+++ b/src/java/org/apache/nutch/parse/ParseUtil.java@@ -15,12 +15,14 @@*/package org.apache.nutch.parse;-// JDK imports-import java.util.logging.Logger;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;// Nutch Importsimport org.apache.nutch.protocol.Content;-import org.apache.hadoop.util.LogFormatter;++// Hadoop importsimport org.apache.hadoop.conf.Configuration;@@ -36,8 +38,7 @@ import org.apache.hadoop.conf.Configuration;public class ParseUtil {/* our log stream */- public static final Logger LOG =- LogFormatter.getLogger(ParseUtil.class.getName());+ public static final Log LOG = LogFactory.getLog(ParseUtil.class);private Configuration conf;private ParserFactory parserFactory;@@ -66,22 +67,22 @@ public class ParseUtil {try {parsers = this.parserFactory.getParsers(content.getContentType(), "");} catch (ParserNotFound e) {- LOG.warning("No suitable parser found when trying to parse content " +- content);+ LOG.warn("No suitable parser found when trying to parse content " ++ content);throw new ParseException(e.getMessage());}Parse parse = null;for (int i=0; i<parsers.length; i++) {- LOG.fine("Parsing [" + content.getUrl() + "] with [" + parsers[i] + "]");+ LOG.debug("Parsing [" + content.getUrl() + "] with [" + parsers[i] + "]");parse = parsers[i].getParse(content);if ((parse != null) && (parse.getData().getStatus().isSuccess())) {return parse;}}- LOG.warning("Unable to successfully parse content " + content.getUrl() +- " of type " + content.getContentType());+ LOG.warn("Unable to successfully parse content " + content.getUrl() ++ " of type " + content.getContentType());ParseStatus ps = (parse.getData() != null) ? parse.getData().getStatus() : null;return (ps == null) ? new ParseStatus().getEmptyParse(this.conf)@@ -115,8 +116,8 @@ public class ParseUtil {try {p = this.parserFactory.getParserById(extId);} catch (ParserNotFound e) {- LOG.warning("No suitable parser found when trying to parse content " +- content);+ LOG.warn("No suitable parser found when trying to parse content " ++ content);throw new ParseException(e.getMessage());}@@ -125,8 +126,8 @@ public class ParseUtil {if (parse != null && parse.getData().getStatus().isSuccess()) {return parse;} else {- LOG.warning("Unable to successfully parse content " + content.getUrl() +- " of type " + content.getContentType());+ LOG.warn("Unable to successfully parse content " + content.getUrl() ++ " of type " + content.getContentType());return new ParseStatus().getEmptyParse(this.conf);}}diff --git a/src/java/org/apache/nutch/parse/ParserChecker.java b/src/java/org/apache/nutch/parse/ParserChecker.javaindex c1f5411e8..ead03dbc6 100644--- a/src/java/org/apache/nutch/parse/ParserChecker.java+++ b/src/java/org/apache/nutch/parse/ParserChecker.java@@ -16,7 +16,9 @@package org.apache.nutch.parse;-import org.apache.hadoop.util.LogFormatter;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.hadoop.conf.Configuration;import org.apache.nutch.util.NutchConfiguration;@@ -29,8 +31,6 @@ import org.apache.nutch.protocol.ProtocolFactory;import org.apache.nutch.protocol.Protocol;import org.apache.nutch.protocol.Content;-import java.util.logging.Logger;-/*** Parser checker, useful for testing parser.*@@ -39,8 +39,7 @@ import java.util.logging.Logger;public class ParserChecker {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.parse.ParserChecker");+ public static final Log LOG = LogFactory.getLog(ParserChecker.class);public ParserChecker() {}diff --git a/src/java/org/apache/nutch/parse/ParserFactory.java b/src/java/org/apache/nutch/parse/ParserFactory.javaindex 3212a6b64..7eba80cc4 100644--- a/src/java/org/apache/nutch/parse/ParserFactory.java+++ b/src/java/org/apache/nutch/parse/ParserFactory.java@@ -21,15 +21,20 @@ import java.util.Collections;import java.util.Iterator;import java.util.List;import java.util.Vector;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;++// Hadoop imports+import org.apache.hadoop.conf.Configuration;// Nutch importsimport org.apache.nutch.plugin.Extension;import org.apache.nutch.plugin.ExtensionPoint;import org.apache.nutch.plugin.PluginRuntimeException;import org.apache.nutch.plugin.PluginRepository;-import org.apache.hadoop.util.LogFormatter;-import org.apache.hadoop.conf.Configuration;+import org.apache.nutch.util.LogUtil;import org.apache.nutch.util.mime.MimeType;import org.apache.nutch.util.mime.MimeTypeException;@@ -37,8 +42,7 @@ import org.apache.nutch.util.mime.MimeTypeException;/** Creates and caches {@link Parser} plugins.*/public final class ParserFactory {- public static final Logger LOG =- LogFormatter.getLogger(ParserFactory.class.getName());+ public static final Log LOG = LogFactory.getLog(ParserFactory.class);/** Wildcard for default plugins. */public static final String DEFAULT_PLUGIN = "*";@@ -127,12 +131,12 @@ public final class ParserFactory {}parsers.add(p);} catch (PluginRuntimeException e) {- e.printStackTrace();- LOG.warning("ParserFactory:PluginRuntimeException when "- + "initializing parser plugin "- + ext.getDescriptor().getPluginId()- + " instance in getParsers "- + "function: attempting to continue instantiating parsers");+ e.printStackTrace(LogUtil.getWarnStream(LOG));+ LOG.warn("ParserFactory:PluginRuntimeException when "+ + "initializing parser plugin "+ + ext.getDescriptor().getPluginId()+ + " instance in getParsers "+ + "function: attempting to continue instantiating parsers");}}return (Parser[]) parsers.toArray(new Parser[]{});@@ -185,9 +189,9 @@ public final class ParserFactory {this.conf.setObject(parserExt.getId(), p);return p;} catch (PluginRuntimeException e) {- LOG.warning("Canno initialize parser " +- parserExt.getDescriptor().getPluginId() +- " (cause: " + e.toString());+ LOG.warn("Canno initialize parser " ++ parserExt.getDescriptor().getPluginId() ++ " (cause: " + e.toString());throw new ParserNotFound("Cannot init parser for id [" + id + "]");}}@@ -207,8 +211,8 @@ public final class ParserFactory {try {type = MimeType.clean(contentType);} catch (MimeTypeException mte) {- LOG.fine("Could not clean the content-type [" + contentType +- "], Reason is [" + mte + "]. Using its raw version...");+ LOG.debug("Could not clean the content-type [" + contentType ++ "], Reason is [" + mte + "]. Using its raw version...");type = contentType;}@@ -300,17 +304,17 @@ public final class ParserFactory {// plugin was enabled via plugin.includes// its plugin.xml just doesn't claim to support that// particular mimeType- LOG.warning("ParserFactory:Plugin: " + parsePluginId +- " mapped to contentType " + contentType +- " via parse-plugins.xml, but " + "its plugin.xml " +- "file does not claim to support contentType: " +- contentType);+ LOG.warn("ParserFactory:Plugin: " + parsePluginId ++ " mapped to contentType " + contentType ++ " via parse-plugins.xml, but " + "its plugin.xml " ++ "file does not claim to support contentType: " ++ contentType);} else {// plugin wasn't enabled via plugin.includes- LOG.warning("ParserFactory: Plugin: " + parsePluginId +- " mapped to contentType " + contentType +- " via parse-plugins.xml, but not enabled via " +- "plugin.includes in nutch-default.xml");+ LOG.warn("ParserFactory: Plugin: " + parsePluginId ++ " mapped to contentType " + contentType ++ " via parse-plugins.xml, but not enabled via " ++ "plugin.includes in nutch-default.xml");}}@@ -344,8 +348,8 @@ public final class ParserFactory {contentType + ", but they are not mapped to it in the " +"parse-plugins.xml file");} else {- LOG.fine("ParserFactory:No parse plugins mapped or enabled for " +- "contentType " + contentType);+ LOG.debug("ParserFactory:No parse plugins mapped or enabled for " ++ "contentType " + contentType);}}diff --git a/src/java/org/apache/nutch/plugin/PluginDescriptor.java b/src/java/org/apache/nutch/plugin/PluginDescriptor.javaindex f77c69759..8df6d1017 100644--- a/src/java/org/apache/nutch/plugin/PluginDescriptor.java+++ b/src/java/org/apache/nutch/plugin/PluginDescriptor.java@@ -15,6 +15,8 @@* limitations under the License.*/package org.apache.nutch.plugin;++// JDK importsimport java.io.File;import java.io.IOException;import java.net.MalformedURLException;@@ -25,8 +27,15 @@ import java.util.Locale;import java.util.MissingResourceException;import java.util.ResourceBundle;import java.util.logging.Logger;-import org.apache.hadoop.util.LogFormatter;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;++// Hadoop importsimport org.apache.hadoop.conf.Configuration;++/*** The <code>PluginDescriptor</code> provide access to all meta information of* a nutch-plugin, as well to the internationalizable resources and the plugin@@ -51,8 +60,7 @@ public class PluginDescriptor {private ArrayList fNotExportedLibs = new ArrayList();private ArrayList fExtensions = new ArrayList();private PluginClassLoader fClassLoader;- public static final Logger LOG = LogFormatter- .getLogger(PluginDescriptor.class.getName());+ public static final Log LOG = LogFactory.getLog(PluginDescriptor.class);private Configuration fConf;/**@@ -265,7 +273,7 @@ public class PluginDescriptor {arrayList.add(file2.getParentFile().toURL());}} catch (MalformedURLException e) {- LOG.fine(getPluginId() + " " + e.toString());+ LOG.debug(getPluginId() + " " + e.toString());}URL[] urls = (URL[]) arrayList.toArray(new URL[arrayList.size()]);fClassLoader = new PluginClassLoader(urls, PluginDescriptor.classdiff --git a/src/java/org/apache/nutch/plugin/PluginManifestParser.java b/src/java/org/apache/nutch/plugin/PluginManifestParser.javaindex 13250e07b..cc0b5b0ba 100644--- a/src/java/org/apache/nutch/plugin/PluginManifestParser.java+++ b/src/java/org/apache/nutch/plugin/PluginManifestParser.java@@ -24,12 +24,13 @@ import java.net.URL;import java.net.URLDecoder;import java.util.HashMap;import java.util.Map;-import java.util.logging.Logger;import javax.xml.parsers.DocumentBuilder;import javax.xml.parsers.DocumentBuilderFactory;import javax.xml.parsers.ParserConfigurationException;+import org.apache.commons.logging.Log;+import org.apache.hadoop.conf.Configuration;import org.w3c.dom.Document;import org.w3c.dom.Element;@@ -44,7 +45,7 @@ import org.xml.sax.SAXException;* @author joa23*/public class PluginManifestParser {- public static final Logger LOG = PluginRepository.LOG;+ public static final Log LOG = PluginRepository.LOG;private static final boolean WINDOWS = System.getProperty("os.name").startsWith("Windows");@@ -87,17 +88,17 @@ public class PluginManifestParser {String manifestPath = oneSubFolder.getAbsolutePath()+ File.separator + "plugin.xml";try {- LOG.fine("parsing: " + manifestPath);+ LOG.debug("parsing: " + manifestPath);PluginDescriptor p = parseManifestFile(manifestPath);map.put(p.getPluginId(), p);} catch (MalformedURLException e) {- LOG.warning(e.toString());+ LOG.warn(e.toString());} catch (SAXException e) {- LOG.warning(e.toString());+ LOG.warn(e.toString());} catch (IOException e) {- LOG.warning(e.toString());+ LOG.warn(e.toString());} catch (ParserConfigurationException e) {- LOG.warning(e.toString());+ LOG.warn(e.toString());}}}@@ -118,10 +119,10 @@ public class PluginManifestParser {&& directory.isDirectory() && directory.listFiles().length > 0) {return directory; // relative path that is not in the classpath} else if (url == null) {- LOG.warning("Plugins: directory not found: " + name);+ LOG.warn("Plugins: directory not found: " + name);return null;} else if (!"file".equals(url.getProtocol())) {- LOG.warning("Plugins: not a file: url. Can't load plugins from: "+ LOG.warn("Plugins: not a file: url. Can't load plugins from: "+ url);return null;}@@ -184,7 +185,7 @@ public class PluginManifestParser {}PluginDescriptor pluginDescriptor = new PluginDescriptor(id, version,name, providerName, pluginClazz, pPath, this.conf);- LOG.fine("plugin: id="+id+" name="+name+" version="+version+ LOG.debug("plugin: id="+id+" name="+name+" version="+version+" provider="+providerName+"class="+pluginClazz);parseExtension(rootElement, pluginDescriptor);parseExtensionPoints(rootElement, pluginDescriptor);@@ -259,7 +260,7 @@ public class PluginManifestParser {String schema = oneExtensionPoint.getAttribute("schema");ExtensionPoint extensionPoint = new ExtensionPoint(id, name,schema);- //LOG.fine("plugin: point="+id);+ //LOG.debug("plugin: point="+id);pPluginDescriptor.addExtensionPoint(extensionPoint);}}@@ -289,7 +290,7 @@ public class PluginManifestParser {String id = oneImplementation.getAttribute("id");String extensionClass = oneImplementation.getAttribute("class");- LOG.fine("impl: point=" + pointId + " class="+ LOG.debug("impl: point=" + pointId + " class="+ extensionClass);Extension extension = new Extension(pPluginDescriptor,pointId, id, extensionClass, this.conf, this.pluginRepository);diff --git a/src/java/org/apache/nutch/plugin/PluginRepository.java b/src/java/org/apache/nutch/plugin/PluginRepository.javaindex 269718ad2..bdaa5c4b0 100644--- a/src/java/org/apache/nutch/plugin/PluginRepository.java+++ b/src/java/org/apache/nutch/plugin/PluginRepository.java@@ -26,14 +26,19 @@ import java.util.WeakHashMap;import java.util.Iterator;import java.util.List;import java.util.Map;-import java.util.logging.Logger;import java.util.regex.Pattern;-// Nutch imports-import org.apache.hadoop.util.LogFormatter;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;++// Hadoop importsimport org.apache.hadoop.conf.Configuration;++// Nutch importsimport org.apache.nutch.util.NutchConfiguration;+/*** The plugin repositority is a registry of all plugins.*@@ -60,8 +65,7 @@ public class PluginRepository {private Configuration conf;- public static final Logger LOG = LogFormatter- .getLogger("org.apache.nutch.plugin.PluginRepository");+ public static final Log LOG = LogFactory.getLog(PluginRepository.class);/*** @throws PluginRuntimeException@@ -87,7 +91,7 @@ public class PluginRepository {try {installExtensions(fRegisteredPlugins);} catch (PluginRuntimeException e) {- LOG.severe(e.toString());+ LOG.fatal(e.toString());throw new RuntimeException(e.getMessage());}displayStatus();@@ -115,7 +119,7 @@ public class PluginRepository {for (int j=0; j<points.length; j++) {ExtensionPoint point = points[j];String xpId = point.getId();- LOG.fine("Adding extension point " + xpId);+ LOG.debug("Adding extension point " + xpId);fExtensionPoints.put(xpId, point);}}@@ -206,10 +210,10 @@ public class PluginRepository {checked.put(plugin.getPluginId(), plugin);} catch (MissingDependencyException mde) {// Simply ignore this plugin- LOG.warning(mde.getMessage());+ LOG.warn(mde.getMessage());} catch (CircularDependencyException cde) {// Simply ignore this plugin- LOG.warning(cde.getMessage());+ LOG.warn(cde.getMessage());}}return new ArrayList(checked.values());@@ -362,11 +366,11 @@ public class PluginRepository {if (id == null) { continue; }if (!includes.matcher(id).matches()) {- LOG.fine("not including: " + id);+ LOG.debug("not including: " + id);continue;}if (excludes.matcher(id).matches()) {- LOG.fine("excluding: " + id);+ LOG.debug("excluding: " + id);continue;}map.put(plugin.getPluginId(), plugin);diff --git a/src/java/org/apache/nutch/protocol/ProtocolFactory.java b/src/java/org/apache/nutch/protocol/ProtocolFactory.javaindex f7eb4ac20..1a3662681 100644--- a/src/java/org/apache/nutch/protocol/ProtocolFactory.java+++ b/src/java/org/apache/nutch/protocol/ProtocolFactory.java@@ -19,10 +19,12 @@ package org.apache.nutch.protocol;import java.net.URL;import java.net.MalformedURLException;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.nutch.plugin.*;-import java.util.logging.Logger;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;/** Creates and caches {@link Protocol} plugins. Protocol plugins should@@ -30,8 +32,7 @@ import org.apache.hadoop.conf.Configuration;* implement. */public class ProtocolFactory {- public static final Logger LOG = LogFormatter- .getLogger(ProtocolFactory.class.getName());+ public static final Log LOG = LogFactory.getLog(ProtocolFactory.class);private ExtensionPoint extensionPoint;private Configuration conf;diff --git a/src/java/org/apache/nutch/searcher/DistributedSearch.java b/src/java/org/apache/nutch/searcher/DistributedSearch.javaindex 6ecbe4ffe..663e434d8 100644--- a/src/java/org/apache/nutch/searcher/DistributedSearch.java+++ b/src/java/org/apache/nutch/searcher/DistributedSearch.java@@ -19,14 +19,15 @@ package org.apache.nutch.searcher;import java.net.InetSocketAddress;import java.io.*;import java.util.*;-import java.util.logging.Logger;import java.lang.reflect.Method;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.nutch.parse.ParseData;import org.apache.nutch.parse.ParseText;import org.apache.nutch.crawl.Inlinks;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.ipc.RPC;import org.apache.hadoop.fs.Path;@@ -36,8 +37,7 @@ import org.apache.nutch.util.NutchConfiguration;/** Implements the search API over IPC connnections. */public class DistributedSearch {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.searcher.DistributedSearch");+ public static final Log LOG = LogFactory.getLog(DistributedSearch.class);private DistributedSearch() {} // no public ctor@@ -171,11 +171,11 @@ public class DistributedSearch {InetSocketAddress addr = defaultAddresses[i];String[] segments = results[i];if (segments == null) {- LOG.warning("Client: no segments from: " + addr);+ LOG.warn("Client: no segments from: " + addr);continue;}for (int j = 0; j < segments.length; j++) {- LOG.finest("Client: segment "+segments[j]+" at "+addr);+ LOG.trace("Client: segment "+segments[j]+" at "+addr);segmentToAddress.put(segments[j], addr);}liveAddresses.add(addr);@@ -355,7 +355,7 @@ public class DistributedSearch {LOG.info("Querying segments from search servers...");updateSegments();} catch (IOException ioe) {- LOG.warning("No search servers available!");+ LOG.warn("No search servers available!");liveAddresses=new InetSocketAddress[0];}}diff --git a/src/java/org/apache/nutch/searcher/NutchBean.java b/src/java/org/apache/nutch/searcher/NutchBean.javaindex f298e69be..9e7134503 100644--- a/src/java/org/apache/nutch/searcher/NutchBean.java+++ b/src/java/org/apache/nutch/searcher/NutchBean.java@@ -18,13 +18,14 @@ package org.apache.nutch.searcher;import java.io.*;import java.util.*;-import java.util.logging.Logger;import javax.servlet.ServletContext;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.hadoop.fs.*;import org.apache.hadoop.io.Closeable;import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.parse.*;import org.apache.nutch.indexer.*;import org.apache.nutch.crawl.Inlinks;@@ -38,12 +39,11 @@ public class NutchBeanimplements Searcher, HitDetailer, HitSummarizer, HitContent, HitInlinks,DistributedSearch.Protocol, Closeable {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.searcher.NutchBean");+ public static final Log LOG = LogFactory.getLog(NutchBean.class);- static {- LogFormatter.setShowThreadIDs(true);- }+// static {+// LogFormatter.setShowThreadIDs(true);+// }private String[] segmentNames;diff --git a/src/java/org/apache/nutch/searcher/OpenSearchServlet.java b/src/java/org/apache/nutch/searcher/OpenSearchServlet.javaindex c77e54bd8..9f1110f17 100644--- a/src/java/org/apache/nutch/searcher/OpenSearchServlet.java+++ b/src/java/org/apache/nutch/searcher/OpenSearchServlet.java@@ -18,7 +18,6 @@ package org.apache.nutch.searcher;import java.io.IOException;import java.net.URLEncoder;-import java.util.logging.Level;import java.util.Map;import java.util.HashMap;import java.util.Set;@@ -133,7 +132,7 @@ public class OpenSearchServlet extends HttpServlet {hits = bean.search(query, start + hitsPerPage, hitsPerDup, dedupField,sort, reverse);} catch (IOException e) {- NutchBean.LOG.log(Level.WARNING, "Search Error", e);+ NutchBean.LOG.warn("Search Error", e);hits = new Hits(0,new Hit[0]);}diff --git a/src/java/org/apache/nutch/searcher/Query.java b/src/java/org/apache/nutch/searcher/Query.javaindex 0e8c272ee..a414403a0 100644--- a/src/java/org/apache/nutch/searcher/Query.java+++ b/src/java/org/apache/nutch/searcher/Query.java@@ -23,12 +23,14 @@ import java.io.BufferedReader;import java.io.InputStreamReader;import java.util.Arrays;import java.util.ArrayList;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.conf.Configurable;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.io.Writable;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.analysis.AnalyzerFactory;import org.apache.nutch.analysis.NutchAnalysis;@@ -36,8 +38,7 @@ import org.apache.nutch.util.NutchConfiguration;/** A Nutch query. */public final class Query implements Writable, Cloneable, Configurable {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.searcher.Query");+ public static final Log LOG = LogFactory.getLog(Query.class);/** A query clause. */public static class Clause implements Cloneable {diff --git a/src/java/org/apache/nutch/searcher/QueryFilters.java b/src/java/org/apache/nutch/searcher/QueryFilters.javaindex 71d42a728..863ebcdee 100644--- a/src/java/org/apache/nutch/searcher/QueryFilters.java+++ b/src/java/org/apache/nutch/searcher/QueryFilters.java@@ -16,12 +16,13 @@package org.apache.nutch.searcher;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.nutch.plugin.*;import org.apache.nutch.searcher.Query.Clause;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;-import java.util.logging.Logger;import java.util.*;import org.apache.lucene.search.BooleanQuery;@@ -34,8 +35,7 @@ import org.apache.lucene.search.BooleanQuery;* are parsed as multi-token Query.Phrase's.*/public class QueryFilters {- private static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.searcher.QueryFilters");+ private static final Log LOG = LogFactory.getLog(QueryFilters.class);private QueryFilter[] queryFilters;private HashSet FIELD_NAMES ;@@ -66,7 +66,7 @@ public class QueryFilters {ArrayList fieldNames = parseFieldNames(extension, "fields");ArrayList rawFieldNames = parseFieldNames(extension, "raw-fields");if (fieldNames.size() == 0 && rawFieldNames.size() == 0) {- LOG.warning("QueryFilter: " + extension.getId()+ LOG.warn("QueryFilter: " + extension.getId()+ " names no fields.");continue;}diff --git a/src/java/org/apache/nutch/searcher/SummarizerFactory.java b/src/java/org/apache/nutch/searcher/SummarizerFactory.javaindex d8b30d602..8e9725cfa 100644--- a/src/java/org/apache/nutch/searcher/SummarizerFactory.java+++ b/src/java/org/apache/nutch/searcher/SummarizerFactory.java@@ -15,12 +15,12 @@*/package org.apache.nutch.searcher;-// JDK imports-import java.util.logging.Logger;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;// Hadoop importsimport org.apache.hadoop.conf.Configuration;-import org.apache.hadoop.util.LogFormatter;// Nutch importsimport org.apache.nutch.plugin.Extension;@@ -35,8 +35,7 @@ import org.apache.nutch.plugin.PluginRepository;public class SummarizerFactory {/** My logger */- public final static Logger LOG =- LogFormatter.getLogger(SummarizerFactory.class.getName());+ public final static Log LOG = LogFactory.getLog(SummarizerFactory.class);/** The first available {@link Summarizer} */private Summarizer summarizer = null;@@ -52,7 +51,7 @@ public class SummarizerFactory {LOG.info("Using the first summarizer extension found: " +extensions[0].getId());} catch (Exception e) {- LOG.warning(e.toString());+ LOG.warn(e.toString());}}diff --git a/src/java/org/apache/nutch/segment/SegmentMerger.java b/src/java/org/apache/nutch/segment/SegmentMerger.javaindex 5ee4031e1..4cc97b9da 100644--- a/src/java/org/apache/nutch/segment/SegmentMerger.java+++ b/src/java/org/apache/nutch/segment/SegmentMerger.java@@ -18,7 +18,9 @@ package org.apache.nutch.segment;import java.io.IOException;import java.util.*;-import java.util.logging.Logger;++import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.conf.*;import org.apache.hadoop.fs.FileSystem;@@ -84,7 +86,7 @@ import org.apache.nutch.util.NutchConfiguration;* @author Andrzej Bialecki*/public class SegmentMerger extends Configured implements Mapper, Reducer {- private static final Logger LOG = Logger.getLogger(SegmentMerger.class.getName());+ private static final Log LOG = LogFactory.getLog(SegmentMerger.class);private static final UTF8 SEGMENT_PART_KEY = new UTF8("_PaRt_");private static final UTF8 SEGMENT_NAME_KEY = new UTF8("_NaMe_");@@ -335,7 +337,7 @@ public class SegmentMerger extends Configured implements Mapper, Reducer {return;}} catch (Exception e) {- LOG.warning("Cannot filter key " + key + ": " + e.getMessage());+ LOG.warn("Cannot filter key " + key + ": " + e.getMessage());}}output.collect(key, value);@@ -545,7 +547,7 @@ public class SegmentMerger extends Configured implements Mapper, Reducer {boolean pt = true;for (int i = 0; i < segs.length; i++) {if (!fs.exists(segs[i])) {- LOG.warning("SegmentMerger: input dir " + segs[i] + " doesn't exist, skipping.");+ LOG.warn("SegmentMerger: input dir " + segs[i] + " doesn't exist, skipping.");segs[i] = null;continue;}diff --git a/src/java/org/apache/nutch/segment/SegmentReader.java b/src/java/org/apache/nutch/segment/SegmentReader.javaindex 365aca1ea..ae85741b4 100644--- a/src/java/org/apache/nutch/segment/SegmentReader.java+++ b/src/java/org/apache/nutch/segment/SegmentReader.java@@ -19,24 +19,26 @@ package org.apache.nutch.segment;import java.io.*;import java.text.SimpleDateFormat;import java.util.*;-import java.util.logging.Logger;++import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.conf.Configured;import org.apache.hadoop.fs.*;import org.apache.hadoop.io.*;import org.apache.hadoop.mapred.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.crawl.CrawlDatum;import org.apache.nutch.parse.ParseData;import org.apache.nutch.parse.ParseText;import org.apache.nutch.protocol.Content;+import org.apache.nutch.util.LogUtil;import org.apache.nutch.util.NutchConfiguration;/** Dump the content of a segment. */public class SegmentReader extends Configured implements Reducer {- public static final Logger LOG = LogFormatter.getLogger(SegmentReader.class.getName());+ public static final Log LOG = LogFactory.getLog(SegmentReader.class);long recNo = 0L;@@ -105,7 +107,7 @@ public class SegmentReader extends Configured implements Reducer {try {this.fs = FileSystem.get(getConf());} catch (IOException e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));}}@@ -120,7 +122,7 @@ public class SegmentReader extends Configured implements Reducer {try {this.fs = FileSystem.get(getConf());} catch (IOException e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));}}@@ -154,7 +156,7 @@ public class SegmentReader extends Configured implements Reducer {} else if (value instanceof ParseText) {dump.append("\nParseText::\n").append(((ParseText) value).toString());} else {- LOG.warning("Unrecognized type: " + value.getClass());+ LOG.warn("Unrecognized type: " + value.getClass());}}output.collect(key, new ObjectWritable(dump.toString()));@@ -206,8 +208,8 @@ public class SegmentReader extends Configured implements Reducer {try {currentRecordNumber = append(fs, job, partFile, writer, currentRecordNumber);} catch (IOException exception) {- LOG.warning("Couldn't copy the content of " + partFile.toString() + " into " + dumpFile.toString());- LOG.warning(exception.getMessage());+ LOG.warn("Couldn't copy the content of " + partFile.toString() + " into " + dumpFile.toString());+ LOG.warn(exception.getMessage());}}} finally {@@ -256,7 +258,7 @@ public class SegmentReader extends Configured implements Reducer {List res = getMapRecords(new Path(segment, Content.DIR_NAME), key);results.put("co", res);} catch (Exception e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));}}});@@ -266,7 +268,7 @@ public class SegmentReader extends Configured implements Reducer {List res = getMapRecords(new Path(segment, CrawlDatum.FETCH_DIR_NAME), key);results.put("fe", res);} catch (Exception e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));}}});@@ -276,7 +278,7 @@ public class SegmentReader extends Configured implements Reducer {List res = getSeqRecords(new Path(segment, CrawlDatum.GENERATE_DIR_NAME), key);results.put("ge", res);} catch (Exception e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));}}});@@ -286,7 +288,7 @@ public class SegmentReader extends Configured implements Reducer {List res = getSeqRecords(new Path(segment, CrawlDatum.PARSE_DIR_NAME), key);results.put("pa", res);} catch (Exception e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));}}});@@ -296,7 +298,7 @@ public class SegmentReader extends Configured implements Reducer {List res = getMapRecords(new Path(segment, ParseData.DIR_NAME), key);results.put("pd", res);} catch (Exception e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));}}});@@ -306,7 +308,7 @@ public class SegmentReader extends Configured implements Reducer {List res = getMapRecords(new Path(segment, ParseText.DIR_NAME), key);results.put("pt", res);} catch (Exception e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));}}});@@ -321,7 +323,7 @@ public class SegmentReader extends Configured implements Reducer {while (it.hasNext()) {if (((Thread)it.next()).isAlive()) cnt++;}- if (cnt > 0) System.err.println("(" + cnt + " to retrieve)");+ if (cnt > 0) LOG.debug("(" + cnt + " to retrieve)");} while (cnt > 0);for (int i = 0; i < keys.length; i++) {List res = (List)results.get(keys[i][0]);diff --git a/src/java/org/apache/nutch/tools/DmozParser.java b/src/java/org/apache/nutch/tools/DmozParser.javaindex f19bc7d0e..52196fab6 100644--- a/src/java/org/apache/nutch/tools/DmozParser.java+++ b/src/java/org/apache/nutch/tools/DmozParser.java@@ -18,7 +18,6 @@ package org.apache.nutch.tools;import java.io.*;import java.util.*;-import java.util.logging.*;import java.util.regex.*;import javax.xml.parsers.*;@@ -26,15 +25,20 @@ import org.xml.sax.*;import org.xml.sax.helpers.*;import org.apache.xerces.util.XMLChar;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.hadoop.io.*;import org.apache.hadoop.fs.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;+import org.apache.nutch.util.LogUtil;import org.apache.nutch.util.NutchConfiguration;+/** Utility that converts DMOZ RDF into a flat file of URLs to be injected. */public class DmozParser {- public static final Logger LOG = LogFormatter.getLogger("org.apache.nutch.tools.DmozParser");+ public static final Log LOG = LogFactory.getLog(DmozParser.class);long pages = 0;@@ -176,7 +180,7 @@ public class DmozParser {// Inc the number of pages, insert the page, and// possibly print status.//- System.out.println(curURL);+ LOG.info(curURL);pages++;//@@ -232,25 +236,25 @@ public class DmozParser {* Emit the exception message*/public void error(SAXParseException spe) {- LOG.severe("Error: " + spe.toString() + ": " + spe.getMessage());- spe.printStackTrace(System.err);+ LOG.fatal("Error: " + spe.toString() + ": " + spe.getMessage());+ spe.printStackTrace(LogUtil.getFatalStream(LOG));}/*** Emit the exception message, with line numbers*/public void fatalError(SAXParseException spe) {- LOG.severe("Fatal err: " + spe.toString() + ": " + spe.getMessage());- LOG.severe("Last known line is " + location.getLineNumber() + ", column " + location.getColumnNumber());- spe.printStackTrace(System.err);+ LOG.fatal("Fatal err: " + spe.toString() + ": " + spe.getMessage());+ LOG.fatal("Last known line is " + location.getLineNumber() + ", column " + location.getColumnNumber());+ spe.printStackTrace(LogUtil.getFatalStream(LOG));}/*** Emit exception warning message*/public void warning(SAXParseException spe) {- LOG.warning("Warning: " + spe.toString() + ": " + spe.getMessage());- spe.printStackTrace(System.err);+ LOG.warn("Warning: " + spe.toString() + ": " + spe.getMessage());+ spe.printStackTrace(LogUtil.getFatalStream(LOG));}}@@ -287,8 +291,8 @@ public class DmozParser {InputSource is = new InputSource(in);reader.parse(is);} catch (Exception e) {- LOG.severe(e.toString());- e.printStackTrace(System.err);+ LOG.fatal(e.toString());+ e.printStackTrace(LogUtil.getFatalStream(LOG));System.exit(0);} finally {in.close();@@ -306,8 +310,8 @@ public class DmozParser {}}catch (Exception e) {- LOG.severe(e.toString());- e.printStackTrace(System.out);+ LOG.fatal(e.toString());+ e.printStackTrace(LogUtil.getFatalStream(LOG));System.exit(0);} finally {in.close();diff --git a/src/java/org/apache/nutch/tools/PruneIndexTool.java b/src/java/org/apache/nutch/tools/PruneIndexTool.javaindex e653a3ac6..795a10650 100644--- a/src/java/org/apache/nutch/tools/PruneIndexTool.java+++ b/src/java/org/apache/nutch/tools/PruneIndexTool.java@@ -35,9 +35,11 @@ import java.io.PrintStream;import java.util.BitSet;import java.util.StringTokenizer;import java.util.Vector;-import java.util.logging.Logger;-import org.apache.hadoop.util.LogFormatter;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.hadoop.conf.Configuration;import org.apache.nutch.util.NutchConfiguration;@@ -96,7 +98,7 @@ import org.apache.lucene.store.FSDirectory;* @author Andrzej Bialecki <[email protected]>*/public class PruneIndexTool implements Runnable {- public static final Logger LOG = LogFormatter.getLogger("org.apache.nutch.tools.PruneIndexTool");+ public static final Log LOG = LogFactory.getLog(PruneIndexTool.class);/** Log the progress every LOG_STEP number of processed documents. */public static int LOG_STEP = 50000;@@ -187,7 +189,7 @@ public class PruneIndexTool implements Runnable {output.flush();output.close();} catch (Exception e) {- LOG.warning("Error closing: " + e.getMessage());+ LOG.warn("Error closing: " + e.getMessage());}}@@ -255,7 +257,7 @@ public class PruneIndexTool implements Runnable {}if (!dryrun) {IndexReader.unlock(dir);- LOG.fine(" - had to unlock index in " + dir);+ LOG.debug(" - had to unlock index in " + dir);}}reader = IndexReader.open(dir);@@ -268,19 +270,19 @@ public class PruneIndexTool implements Runnable {dir = FSDirectory.getDirectory(indexDirs[i], false);if (IndexReader.isLocked(dir)) {if (!unlock) {- LOG.warning(dr + "Index " + indexDirs[i] + " is locked. Skipping...");+ LOG.warn(dr + "Index " + indexDirs[i] + " is locked. Skipping...");continue;}if (!dryrun) {IndexReader.unlock(dir);- LOG.fine(" - had to unlock index in " + dir);+ LOG.debug(" - had to unlock index in " + dir);}}IndexReader r = IndexReader.open(dir);indexes.add(r);numIdx++;} catch (Exception e) {- LOG.warning(dr + "Invalid index in " + indexDirs[i] + " - skipping...");+ LOG.warn(dr + "Invalid index in " + indexDirs[i] + " - skipping...");}}if (indexes.size() == 0) throw new Exception("No input indexes.");@@ -325,7 +327,7 @@ public class PruneIndexTool implements Runnable {try {searcher.search(queries[i], ahc);} catch (IOException e) {- LOG.warning(dr + " - failed: " + e.getMessage());+ LOG.warn(dr + " - failed: " + e.getMessage());continue;}if (bits.cardinality() == 0) {@@ -353,7 +355,7 @@ public class PruneIndexTool implements Runnable {cnt++;}} catch (Exception e) {- LOG.warning(dr + " - failed to delete doc #" + docNum);+ LOG.warn(dr + " - failed to delete doc #" + docNum);}start = docNum + 1;}@@ -368,20 +370,20 @@ public class PruneIndexTool implements Runnable {try {reader.close();} catch (IOException e) {- LOG.warning(dr + "Exception when closing reader(s): " + e.getMessage());+ LOG.warn(dr + "Exception when closing reader(s): " + e.getMessage());}}public static void main(String[] args) throws Exception {if (args.length == 0) {usage();- LOG.severe("Missing arguments");+ LOG.fatal("Missing arguments");return;}File idx = new File(args[0]);if (!idx.isDirectory()) {usage();- LOG.severe("Not a directory: " + idx);+ LOG.fatal("Not a directory: " + idx);return;}Vector paths = new Vector();@@ -396,7 +398,7 @@ public class PruneIndexTool implements Runnable {});if (dirs == null || dirs.length == 0) {usage();- LOG.severe("No indexes in " + idx);+ LOG.fatal("No indexes in " + idx);return;}for (int i = 0; i < dirs.length; i++) {@@ -407,7 +409,7 @@ public class PruneIndexTool implements Runnable {}if (paths.size() == 0) {usage();- LOG.severe("No indexes in " + idx + " or its subdirs.");+ LOG.fatal("No indexes in " + idx + " or its subdirs.");return;}}@@ -430,7 +432,7 @@ public class PruneIndexTool implements Runnable {dryrun = true;} else {usage();- LOG.severe("Unrecognized option: " + args[i]);+ LOG.fatal("Unrecognized option: " + args[i]);return;}}@@ -463,20 +465,20 @@ public class PruneIndexTool implements Runnable {is = conf.getConfResourceAsInputStream(qPath);}if (is == null) {- LOG.severe("Can't load queries from " + qPath);+ LOG.fatal("Can't load queries from " + qPath);return;}try {queries = parseQueries(is);} catch (Exception e) {- LOG.severe("Error parsing queries: " + e.getMessage());+ LOG.fatal("Error parsing queries: " + e.getMessage());return;}try {PruneIndexTool pit = new PruneIndexTool(indexes, queries, checkers, force, dryrun);pit.run();} catch (Exception e) {- LOG.severe("Error running PruneIndexTool: " + e.getMessage());+ LOG.fatal("Error running PruneIndexTool: " + e.getMessage());return;}}diff --git a/src/java/org/apache/nutch/util/DomUtil.java b/src/java/org/apache/nutch/util/DomUtil.javaindex e0b82fcd8..332cdd364 100644--- a/src/java/org/apache/nutch/util/DomUtil.java+++ b/src/java/org/apache/nutch/util/DomUtil.java@@ -33,8 +33,15 @@ import org.w3c.dom.Element;import org.xml.sax.InputSource;import org.xml.sax.SAXException;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;++public class DomUtil {+ private final static Log LOG = LogFactory.getLog(DomUtil.class);+/*** Returns parsed dom tree or null if any error*@@ -54,11 +61,11 @@ public class DomUtil {parser.parse(input);element = (Element) parser.getDocument().getChildNodes().item(0);} catch (FileNotFoundException e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));} catch (SAXException e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));} catch (IOException e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));}return element;}@@ -81,13 +88,13 @@ public class DomUtil {transformer.transform(source, result);os.flush();} catch (UnsupportedEncodingException e1) {- e1.printStackTrace();+ e1.printStackTrace(LogUtil.getWarnStream(LOG));} catch (IOException e1) {- e1.printStackTrace();+ e1.printStackTrace(LogUtil.getWarnStream(LOG));} catch (TransformerConfigurationException e2) {- e2.printStackTrace();+ e2.printStackTrace(LogUtil.getWarnStream(LOG));} catch (TransformerException ex) {- ex.printStackTrace();+ ex.printStackTrace(LogUtil.getWarnStream(LOG));}}}diff --git a/src/java/org/apache/nutch/util/GZIPUtils.java b/src/java/org/apache/nutch/util/GZIPUtils.javaindex e288a5720..c3bb86902 100644--- a/src/java/org/apache/nutch/util/GZIPUtils.java+++ b/src/java/org/apache/nutch/util/GZIPUtils.java@@ -22,11 +22,16 @@ import java.io.IOException;import java.util.zip.GZIPInputStream;import java.util.zip.GZIPOutputStream;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+/*** A collection of utility methods for working on GZIPed data.*/public class GZIPUtils {-++ private static final Log LOG = LogFactory.getLog(GZIPUtils.class);private static final int EXPECTED_COMPRESSION_RATIO= 5;private static final int BUF_SIZE= 4096;@@ -124,19 +129,19 @@ public class GZIPUtils {try {outStream.write(in);} catch (Exception e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));}try {outStream.close();} catch (IOException e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));}return byteOut.toByteArray();} catch (IOException e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));return null;}}diff --git a/src/java/org/apache/nutch/util/ThreadPool.java b/src/java/org/apache/nutch/util/ThreadPool.javaindex 5c847ee2e..f9abf7865 100644--- a/src/java/org/apache/nutch/util/ThreadPool.java+++ b/src/java/org/apache/nutch/util/ThreadPool.java@@ -17,8 +17,11 @@package org.apache.nutch.util;import java.util.*;-import java.util.logging.*;-import org.apache.hadoop.util.LogFormatter;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+/************************************************* ThreadPool.java@@ -70,8 +73,8 @@ public class ThreadPool {TaskThread t = new TaskThread();t.start();}- Logger l = LogFormatter.getLogger("org.apache.nutch.util");- l.fine("ThreadPool created with " + numThreads + " threads.");+ Log l = LogFactory.getLog("org.apache.nutch.util");+ l.debug("ThreadPool created with " + numThreads + " threads.");}/**@@ -126,7 +129,7 @@ public class ThreadPool {*/public void shutdown() {running = false;- Logger l = LogFormatter.getLogger("org.apache.nutch.util");- l.fine("ThreadPool shutting down.");+ Log l = LogFactory.getLog("org.apache.nutch.util");+ l.debug("ThreadPool shutting down.");}}diff --git a/src/java/org/apache/nutch/util/mime/MimeTypes.java b/src/java/org/apache/nutch/util/mime/MimeTypes.javaindex 2555cf942..a8b08f3b0 100644--- a/src/java/org/apache/nutch/util/mime/MimeTypes.java+++ b/src/java/org/apache/nutch/util/mime/MimeTypes.java@@ -23,7 +23,9 @@ import java.util.List;import java.util.HashMap;import java.util.Iterator;import java.util.ArrayList;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;/**@@ -64,7 +66,7 @@ public final class MimeTypes {/** Should never be instanciated from outside */- private MimeTypes(String filepath, Logger logger) {+ private MimeTypes(String filepath, Log logger) {MimeTypesReader reader = new MimeTypesReader(logger);add(reader.read(filepath));}@@ -93,7 +95,7 @@ public final class MimeTypes {* @param logger is it Logger to uses for ouput messages.* @return A MimeTypes instance for the specified filepath xml file.*/- public static MimeTypes get(String filepath, Logger logger) {+ public static MimeTypes get(String filepath, Log logger) {MimeTypes instance = null;synchronized(instances) {instance = (MimeTypes) instances.get(filepath);diff --git a/src/java/org/apache/nutch/util/mime/MimeTypesReader.java b/src/java/org/apache/nutch/util/mime/MimeTypesReader.javaindex 804510dcf..03e7614f5 100644--- a/src/java/org/apache/nutch/util/mime/MimeTypesReader.java+++ b/src/java/org/apache/nutch/util/mime/MimeTypesReader.java@@ -15,6 +15,10 @@*/package org.apache.nutch.util.mime;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+// DOM importsimport org.w3c.dom.Text;import org.w3c.dom.Attr;@@ -28,8 +32,6 @@ import org.xml.sax.InputSource;// JDK importsimport java.io.InputStream;import java.util.ArrayList;-import java.util.logging.Level;-import java.util.logging.Logger;import javax.xml.parsers.DocumentBuilder;import javax.xml.parsers.DocumentBuilderFactory;@@ -42,12 +44,12 @@ import javax.xml.parsers.DocumentBuilderFactory;final class MimeTypesReader {/** The logger to use */- private Logger logger = null;+ private Log logger = null;- MimeTypesReader(Logger logger) {+ MimeTypesReader(Log logger) {if (logger == null) {- this.logger = Logger.getLogger(this.getClass().getName());+ this.logger = LogFactory.getLog(this.getClass());} else {this.logger = logger;}@@ -66,7 +68,7 @@ final class MimeTypesReader {Document document = builder.parse(new InputSource(stream));types = visit(document);} catch (Exception e) {- logger.warning(e.toString() + " while loading mime-types");+ logger.warn(e.toString() + " while loading mime-types");types = new MimeType[0];}return types;@@ -121,8 +123,8 @@ final class MimeTypesReader {type = new MimeType(name);} catch (MimeTypeException mte) {// Mime Type not valid... just ignore it- if (logger.isLoggable(Level.INFO)) {- logger.log(Level.INFO, mte.toString() + " ... Ignoring!");+ if (logger.isInfoEnabled()) {+ logger.info(mte.toString() + " ... Ignoring!");}return null;}diff --git a/src/plugin/analysis-fr/plugin.xml b/src/plugin/analysis-fr/plugin.xmlindex d1130297b..5f025aa8b 100644--- a/src/plugin/analysis-fr/plugin.xml+++ b/src/plugin/analysis-fr/plugin.xml@@ -18,10 +18,10 @@</requires><extension id="org.apache.nutch.analysis.fr"- name="FrenchAnalyzer"+ name="French Analyzer"point="org.apache.nutch.analysis.NutchAnalyzer">- <implementation id="org.apache.nutch.analysis.fr.FrenchAnalyzer"+ <implementation id="FrenchAnalyzer"class="org.apache.nutch.analysis.fr.FrenchAnalyzer"><parameter name="lang" value="fr"/></implementation>diff --git a/src/plugin/clustering-carrot2/src/java/org/apache/nutch/clustering/carrot2/Clusterer.java b/src/plugin/clustering-carrot2/src/java/org/apache/nutch/clustering/carrot2/Clusterer.javaindex 87196d366..df5b375af 100644--- a/src/plugin/clustering-carrot2/src/java/org/apache/nutch/clustering/carrot2/Clusterer.java+++ b/src/plugin/clustering-carrot2/src/java/org/apache/nutch/clustering/carrot2/Clusterer.java@@ -17,12 +17,12 @@package org.apache.nutch.clustering.carrot2;import java.util.*;-import java.util.logging.Level;-import java.util.logging.Logger;++import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.conf.Configurable;import org.apache.hadoop.conf.Configuration;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.clustering.HitsCluster;import org.apache.nutch.clustering.OnlineClusterer;import org.apache.nutch.searcher.HitDetails;@@ -66,8 +66,7 @@ public class Clusterer implements OnlineClusterer, Configurable {/** Internal clustering process ID in Carrot2 LocalController */private final static String PROCESS_ID = "nutch-lingo";- public static final Logger logger =- LogFormatter.getLogger(Clusterer.class.getName());+ public static final Log logger = LogFactory.getLog(Clusterer.class);/** The LocalController instance used for clustering */private LocalController controller;@@ -129,13 +128,13 @@ public class Clusterer implements OnlineClusterer, Configurable {try {Language lang = AllKnownLanguages.getLanguageForIsoCode(lcode);if (lang == null) {- logger.log(Level.WARNING, "Language not supported in Carrot2: " + lcode);+ logger.warn("Language not supported in Carrot2: " + lcode);} else {languageList.add(lang);- logger.log(Level.FINE, "Language loaded: " + lcode);+ logger.debug("Language loaded: " + lcode);}} catch (Throwable t) {- logger.log(Level.WARNING, "Language could not be loaded: " + lcode, t);+ logger.warn("Language could not be loaded: " + lcode, t);}}return new LingoLocalFilterComponent(@@ -223,8 +222,8 @@ public class Clusterer implements OnlineClusterer, Configurable {this.languages = conf.getStrings(CONF_PROP_LANGUAGES);}- logger.log(Level.INFO, "Default language: " + defaultLanguage);- logger.log(Level.INFO, "Enabled languages: " + Arrays.asList(languages));+ logger.info("Default language: " + defaultLanguage);+ logger.info("Enabled languages: " + Arrays.asList(languages));initialize();}diff --git a/src/plugin/creativecommons/src/java/org/creativecommons/nutch/CCDeleteUnlicensedTool.java b/src/plugin/creativecommons/src/java/org/creativecommons/nutch/CCDeleteUnlicensedTool.javaindex 3b94388f1..29816e2db 100644--- a/src/plugin/creativecommons/src/java/org/creativecommons/nutch/CCDeleteUnlicensedTool.java+++ b/src/plugin/creativecommons/src/java/org/creativecommons/nutch/CCDeleteUnlicensedTool.java@@ -16,21 +16,21 @@package org.creativecommons.nutch;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.indexer.Indexer;import org.apache.lucene.index.IndexReader;import org.apache.lucene.document.Document;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import java.io.*;import java.util.Vector;-import java.util.logging.Logger;/** Deletes documents in a set of Lucene indexes that do not have a Creative* Commons license. */public class CCDeleteUnlicensedTool {- private static final Logger LOG =- LogFormatter.getLogger("org.creativecommons.nutch.CCDeleteUnlicensedTool");+ private static final Log LOG = LogFactory.getLog(CCDeleteUnlicensedTool.class);private IndexReader[] readers;diff --git a/src/plugin/creativecommons/src/java/org/creativecommons/nutch/CCIndexingFilter.java b/src/plugin/creativecommons/src/java/org/creativecommons/nutch/CCIndexingFilter.javaindex 18b6f59ba..020fb0768 100644--- a/src/plugin/creativecommons/src/java/org/creativecommons/nutch/CCIndexingFilter.java+++ b/src/plugin/creativecommons/src/java/org/creativecommons/nutch/CCIndexingFilter.java@@ -31,18 +31,18 @@ import org.apache.nutch.crawl.Inlinks;import org.apache.nutch.metadata.Metadata;import org.apache.nutch.metadata.CreativeCommons;-import java.util.logging.Logger;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import java.util.*;import java.net.URL;import java.net.MalformedURLException;/** Adds basic searchable fields to a document. */public class CCIndexingFilter implements IndexingFilter {- public static final Logger LOG- = LogFormatter.getLogger(CCIndexingFilter.class.getName());+ public static final Log LOG = LogFactory.getLog(CCIndexingFilter.class);/** The name of the document field we use. */public static String FIELD = "cc";@@ -99,7 +99,7 @@ public class CCIndexingFilter implements IndexingFilter {addFeature(doc, feature);}} catch (MalformedURLException e) {- LOG.warning("CC: failed to parse url: " + urlString + " : " + e);+ LOG.warn("CC: failed to parse url: " + urlString + " : " + e);}}diff --git a/src/plugin/creativecommons/src/java/org/creativecommons/nutch/CCParseFilter.java b/src/plugin/creativecommons/src/java/org/creativecommons/nutch/CCParseFilter.javaindex 576b6ace6..75614e6be 100644--- a/src/plugin/creativecommons/src/java/org/creativecommons/nutch/CCParseFilter.java+++ b/src/plugin/creativecommons/src/java/org/creativecommons/nutch/CCParseFilter.java@@ -22,6 +22,9 @@ import org.apache.nutch.protocol.Content;import org.apache.nutch.metadata.Metadata;import org.apache.hadoop.conf.Configuration;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import java.util.*;import java.io.*;import java.net.*;@@ -29,13 +32,10 @@ import javax.xml.parsers.*;import org.xml.sax.InputSource;import org.w3c.dom.*;-import java.util.logging.Logger;-import org.apache.hadoop.util.LogFormatter;/** Adds metadata identifying the Creative Commons license used, if any. */public class CCParseFilter implements HtmlParseFilter {- public static final Logger LOG- = LogFormatter.getLogger(CCParseFilter.class.getName());+ public static final Log LOG = LogFactory.getLog(CCParseFilter.class);/** Walks DOM tree, looking for RDF in comments and licenses in anchors.*/@@ -175,7 +175,7 @@ public class CCParseFilter implements HtmlParseFilter {DocumentBuilder parser = FACTORY.newDocumentBuilder();doc = parser.parse(new InputSource(new StringReader(comment)));} catch (Exception e) {- LOG.warning("CC: Failed to parse RDF in "+base+": "+e);+ LOG.warn("CC: Failed to parse RDF in "+base+": "+e);//e.printStackTrace();return;}@@ -183,7 +183,7 @@ public class CCParseFilter implements HtmlParseFilter {// check that root is rdf:RDFNodeList roots = doc.getElementsByTagNameNS(RDF_NS, "RDF");if (roots.getLength() != 1) {- LOG.warning("CC: No RDF root in "+base);+ LOG.warn("CC: No RDF root in "+base);return;}Element rdf = (Element)roots.item(0);diff --git a/src/plugin/index-basic/src/java/org/apache/nutch/indexer/basic/BasicIndexingFilter.java b/src/plugin/index-basic/src/java/org/apache/nutch/indexer/basic/BasicIndexingFilter.javaindex 85503d441..e3f2cce2b 100644--- a/src/plugin/index-basic/src/java/org/apache/nutch/indexer/basic/BasicIndexingFilter.java+++ b/src/plugin/index-basic/src/java/org/apache/nutch/indexer/basic/BasicIndexingFilter.java@@ -16,6 +16,9 @@package org.apache.nutch.indexer.basic;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;@@ -31,14 +34,11 @@ import org.apache.nutch.crawl.Inlinks;import java.io.IOException;import java.net.MalformedURLException;import java.net.URL;-import java.util.logging.Logger;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;/** Adds basic searchable fields to a document. */public class BasicIndexingFilter implements IndexingFilter {- public static final Logger LOG- = LogFormatter.getLogger(BasicIndexingFilter.class.getName());+ public static final Log LOG = LogFactory.getLog(BasicIndexingFilter.class);private int MAX_TITLE_LENGTH;private Configuration conf;@@ -75,7 +75,7 @@ public class BasicIndexingFilter implements IndexingFilter {doc.add(new Field("anchor", anchors[i], Field.Store.NO, Field.Index.TOKENIZED));}} catch (IOException ioe) {- LOG.warning("BasicIndexingFilter: can't get anchors for " + url.toString());+ LOG.warn("BasicIndexingFilter: can't get anchors for " + url.toString());}// titlediff --git a/src/plugin/index-more/src/java/org/apache/nutch/indexer/more/MoreIndexingFilter.java b/src/plugin/index-more/src/java/org/apache/nutch/indexer/more/MoreIndexingFilter.javaindex 65c8bc864..a078dd5d5 100644--- a/src/plugin/index-more/src/java/org/apache/nutch/indexer/more/MoreIndexingFilter.java+++ b/src/plugin/index-more/src/java/org/apache/nutch/indexer/more/MoreIndexingFilter.java@@ -23,6 +23,9 @@ import org.apache.oro.text.regex.PatternMatcher;import org.apache.oro.text.regex.MatchResult;import org.apache.oro.text.regex.MalformedPatternException;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;@@ -46,9 +49,6 @@ import org.apache.nutch.util.mime.MimeTypeException;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.io.UTF8;-import org.apache.hadoop.util.LogFormatter;--import java.util.logging.Logger;import java.text.ParseException;import java.text.SimpleDateFormat;@@ -73,8 +73,7 @@ import org.apache.commons.lang.time.DateUtils;*/public class MoreIndexingFilter implements IndexingFilter {- public static final Logger LOG- = LogFormatter.getLogger(MoreIndexingFilter.class.getName());+ public static final Log LOG = LogFactory.getLog(MoreIndexingFilter.class);/** A flag that tells if magic resolution must be performed */private boolean MAGIC;@@ -156,9 +155,9 @@ public class MoreIndexingFilter implements IndexingFilter {"dd.MM.yyyy zzz"});time = parsedDate.getTime();- // LOG.warning(url + ": parsed date: " + date +" to:"+time);+ // LOG.warn(url + ": parsed date: " + date +" to:"+time);} catch (Exception e2) {- LOG.warning(url + ": can't parse erroneous date: " + date);+ LOG.warn(url + ": can't parse erroneous date: " + date);}}return time;@@ -195,7 +194,7 @@ public class MoreIndexingFilter implements IndexingFilter {try {mimeType = new MimeType(contentType);} catch (MimeTypeException e) {- LOG.warning(url + e.toString());+ LOG.warn(url + e.toString());mimeType = null;}}diff --git a/src/plugin/languageidentifier/src/java/org/apache/nutch/analysis/lang/HTMLLanguageParser.java b/src/plugin/languageidentifier/src/java/org/apache/nutch/analysis/lang/HTMLLanguageParser.javaindex 67db80ece..77e9412ca 100644--- a/src/plugin/languageidentifier/src/java/org/apache/nutch/analysis/lang/HTMLLanguageParser.java+++ b/src/plugin/languageidentifier/src/java/org/apache/nutch/analysis/lang/HTMLLanguageParser.java@@ -20,7 +20,10 @@ import java.util.Enumeration;import java.util.HashMap;import java.util.Map;import java.util.Properties;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;// Nutch importsimport org.apache.nutch.metadata.Metadata;@@ -30,7 +33,6 @@ import org.apache.nutch.parse.HtmlParseFilter;import org.apache.nutch.protocol.Content;// Hadoop imports-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;// DOM imports@@ -47,8 +49,7 @@ import org.w3c.dom.NodeList;*/public class HTMLLanguageParser implements HtmlParseFilter {- public static final Logger LOG = LogFormatter- .getLogger(HTMLLanguageParser.class.getName());+ public static final Log LOG = LogFactory.getLog(HTMLLanguageParser.class);/* A static Map of ISO-639 language codes */private static Map LANGUAGES_MAP = new HashMap();@@ -67,7 +68,7 @@ public class HTMLLanguageParser implements HtmlParseFilter {}}} catch (Exception e) {- LOG.severe(e.toString());+ LOG.fatal(e.toString());}}diff --git a/src/plugin/languageidentifier/src/java/org/apache/nutch/analysis/lang/LanguageIdentifier.java b/src/plugin/languageidentifier/src/java/org/apache/nutch/analysis/lang/LanguageIdentifier.javaindex c48ddf1dd..6c21f9d0d 100644--- a/src/plugin/languageidentifier/src/java/org/apache/nutch/analysis/lang/LanguageIdentifier.java+++ b/src/plugin/languageidentifier/src/java/org/apache/nutch/analysis/lang/LanguageIdentifier.java@@ -30,12 +30,18 @@ import java.util.Iterator;import java.util.ArrayList;import java.util.Properties;import java.util.Enumeration;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;++// Hadoop imports+import org.apache.hadoop.conf.Configuration;+import org.apache.hadoop.io.UTF8;// Nutch importsimport org.apache.nutch.analysis.lang.NGramProfile.NGramEntry;import org.apache.nutch.crawl.CrawlDatum;-import org.apache.hadoop.io.UTF8;import org.apache.nutch.parse.Parse;import org.apache.nutch.parse.ParseUtil;import org.apache.nutch.parse.ParseException;@@ -45,8 +51,6 @@ import org.apache.nutch.protocol.Protocol;import org.apache.nutch.protocol.ProtocolFactory;import org.apache.nutch.protocol.ProtocolNotFound;import org.apache.nutch.protocol.ProtocolException;-import org.apache.hadoop.conf.Configuration;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.util.NutchConfiguration;@@ -66,8 +70,7 @@ public class LanguageIdentifier {private final static float SCORE_THRESOLD = 0.00F;- private final static Logger LOG =- LogFormatter.getLogger(LanguageIdentifier.class.getName());+ private final static Log LOG = LogFactory.getLog(LanguageIdentifier.class);private ArrayList languages = new ArrayList();@@ -152,7 +155,7 @@ public class LanguageIdentifier {list.append(" " + lang + "(" + ngrams.size() + ")");is.close();} catch (IOException e1) {- LOG.severe(e1.toString());+ LOG.fatal(e1.toString());}}}@@ -170,7 +173,7 @@ public class LanguageIdentifier {// Create the suspect profilesuspect = new NGramProfile("suspect", minLength, maxLength);} catch (Exception e) {- LOG.severe(e.toString());+ LOG.fatal(e.toString());}}diff --git a/src/plugin/languageidentifier/src/java/org/apache/nutch/analysis/lang/NGramProfile.java b/src/plugin/languageidentifier/src/java/org/apache/nutch/analysis/lang/NGramProfile.javaindex 780634910..8718ac640 100644--- a/src/plugin/languageidentifier/src/java/org/apache/nutch/analysis/lang/NGramProfile.java+++ b/src/plugin/languageidentifier/src/java/org/apache/nutch/analysis/lang/NGramProfile.java@@ -32,14 +32,17 @@ import java.util.ArrayList;import java.util.Collections;import java.util.HashMap;import java.util.Map;-import java.util.logging.Logger;-// Nutch imports-import org.apache.hadoop.util.LogFormatter;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;// Lucene importsimport org.apache.lucene.analysis.Token;+// Nutch imports+import org.apache.nutch.util.LogUtil;+/*** This class runs a ngram analysis over submitted text, results might be used@@ -54,8 +57,7 @@ import org.apache.lucene.analysis.Token;*/public class NGramProfile {- public static final Logger LOG = LogFormatter- .getLogger("org.apache.nutch.analysis.lang.NGramProfile");+ public static final Log LOG = LogFactory.getLog(NGramProfile.class);/** The minimum length allowed for a ngram. */final static int ABSOLUTE_MIN_NGRAM_LENGTH = 1;@@ -317,7 +319,7 @@ public class NGramProfile {}}} catch (Exception e) {- LOG.severe(e.toString());+ LOG.fatal(e.toString());}return sum;}@@ -374,7 +376,7 @@ public class NGramProfile {text.append(new String(buffer, 0, len, encoding));}} catch (IOException e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));}newProfile.analyze(text);@@ -521,7 +523,7 @@ public class NGramProfile {}} catch (Exception e) {- LOG.severe("Caught an exception:" + e);+ LOG.fatal("Caught an exception:" + e);}}diff --git a/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java b/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.javaindex 8df566990..77b27d970 100644--- a/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java+++ b/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java@@ -15,15 +15,17 @@*/package org.apache.nutch.protocol.http.api;-// Nutch imports+// JDK importsimport java.io.IOException;import java.net.InetAddress;import java.net.URL;import java.net.UnknownHostException;import java.util.HashMap;import java.util.LinkedList;-import java.util.logging.Level;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;// Nutch importsimport org.apache.nutch.crawl.CrawlDatum;@@ -34,6 +36,7 @@ import org.apache.nutch.protocol.ProtocolException;import org.apache.nutch.protocol.ProtocolOutput;import org.apache.nutch.protocol.ProtocolStatus;import org.apache.nutch.util.GZIPUtils;+import org.apache.nutch.util.LogUtil;// Hadoop importsimport org.apache.hadoop.conf.Configuration;@@ -109,10 +112,10 @@ public abstract class HttpBase implements Protocol {private static LinkedList BLOCKED_ADDR_QUEUE = new LinkedList();/** The default logger */- private final static Logger LOGGER = Logger.getLogger(HttpBase.class.getName());+ private final static Log LOGGER = LogFactory.getLog(HttpBase.class);/** The specified logger */- private Logger logger = LOGGER;+ private Log logger = LOGGER;/** The nutch configuration */private Configuration conf = null;@@ -129,7 +132,7 @@ public abstract class HttpBase implements Protocol {}/** Creates a new instance of HttpBase */- public HttpBase(Logger logger) {+ public HttpBase(Log logger) {if (logger != null) {this.logger = logger;}@@ -175,7 +178,7 @@ public abstract class HttpBase implements Protocol {}} catch (Throwable e) {// XXX Maybe bogus: assume this is allowed.- logger.fine("Exception checking robot rules for " + url + ": " + e);+ logger.trace("Exception checking robot rules for " + url + ": " + e);}String host = blockAddr(u);@@ -228,10 +231,10 @@ public abstract class HttpBase implements Protocol {// handle this in the higher layer.return new ProtocolOutput(c, new ProtocolStatus(protocolStatusCode, u));} else if (code == 400) { // bad request, mark as GONE- logger.fine("400 Bad request: " + u);+ logger.trace("400 Bad request: " + u);return new ProtocolOutput(c, new ProtocolStatus(ProtocolStatus.GONE, u));} else if (code == 401) { // requires authorization, but no valid auth provided.- logger.fine("401 Authentication Required");+ logger.trace("401 Authentication Required");return new ProtocolOutput(c, new ProtocolStatus(ProtocolStatus.ACCESS_DENIED, "Authentication required: "+ urlString));} else if (code == 404) {@@ -243,7 +246,7 @@ public abstract class HttpBase implements Protocol {+ u));}} catch (Throwable e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getErrorStream(logger));return new ProtocolOutput(null, new ProtocolStatus(e));}}@@ -390,7 +393,7 @@ public abstract class HttpBase implements Protocol {String agentEmail) {if ( (agentName == null) || (agentName.trim().length() == 0) )- LOGGER.severe("No User-Agent string set (http.agent.name)!");+ LOGGER.fatal("No User-Agent string set (http.agent.name)!");StringBuffer buf= new StringBuffer();@@ -435,17 +438,18 @@ public abstract class HttpBase implements Protocol {}public byte[] processGzipEncoded(byte[] compressed, URL url) throws IOException {- LOGGER.fine("uncompressing....");+ LOGGER.trace("uncompressing....");byte[] content = GZIPUtils.unzipBestEffort(compressed, getMaxContent());if (content == null)throw new IOException("unzipBestEffort returned null");- if (LOGGER.isLoggable(Level.FINE))- LOGGER.fine("fetched " + compressed.length- + " bytes of compressed content (expanded to "- + content.length + " bytes) from " + url);+ if (LOGGER.isTraceEnabled()) {+ LOGGER.trace("fetched " + compressed.length+ + " bytes of compressed content (expanded to "+ + content.length + " bytes) from " + url);+ }return content;}@@ -472,9 +476,9 @@ public abstract class HttpBase implements Protocol {url = args[i];}- if (verbose) {- LOGGER.setLevel(Level.FINE);- }+// if (verbose) {+// LOGGER.setLevel(Level.FINE);+// }ProtocolOutput out = http.getProtocolOutput(new UTF8(url), new CrawlDatum());Content content = out.getContent();diff --git a/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/RobotRulesParser.java b/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/RobotRulesParser.javaindex a8f9072dd..88bff4262 100644--- a/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/RobotRulesParser.java+++ b/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/RobotRulesParser.java@@ -26,12 +26,13 @@ import java.util.ArrayList;import java.util.HashMap;import java.util.Hashtable;import java.util.StringTokenizer;-import java.util.logging.Logger;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;// Nutch importsimport org.apache.hadoop.conf.Configuration;import org.apache.hadoop.conf.Configurable;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.crawl.CrawlDatum;import org.apache.nutch.net.protocols.Response;import org.apache.nutch.protocol.ProtocolException;@@ -48,8 +49,7 @@ import org.apache.nutch.protocol.ProtocolException;*/public class RobotRulesParser implements Configurable {- public static final Logger LOG=- LogFormatter.getLogger(RobotRulesParser.class.getName());+ public static final Log LOG = LogFactory.getLog(RobotRulesParser.class);private boolean allowForbidden = false;@@ -206,11 +206,11 @@ public class RobotRulesParser implements Configurable {//if (agents.size() == 0) {agents.add(agentName);- LOG.severe("No agents listed in 'http.robots.agents' property!");+ LOG.fatal("No agents listed in 'http.robots.agents' property!");} else if (!((String)agents.get(0)).equalsIgnoreCase(agentName)) {agents.add(0, agentName);- LOG.severe("Agent we advertise (" + agentName- + ") not listed first in 'http.robots.agents' property!");+ LOG.fatal("Agent we advertise (" + agentName+ + ") not listed first in 'http.robots.agents' property!");}setRobotNames((String[]) agents.toArray(new String[agents.size()]));}@@ -320,8 +320,7 @@ public class RobotRulesParser implements Configurable {try {path= URLDecoder.decode(path, CHARACTER_ENCODING);} catch (Exception e) {- LOG.warning("error parsing robots rules- can't decode path: "- + path);+ LOG.warn("error parsing robots rules- can't decode path: " + path);}if (path.length() == 0) { // "empty rule"@@ -389,7 +388,7 @@ public class RobotRulesParser implements Configurable {RobotRuleSet robotRules = (RobotRuleSet)CACHE.get(host);if (robotRules == null) { // cache miss- LOG.fine("cache miss " + url);+ LOG.trace("cache miss " + url);try {Response response = http.getResponse(new URL(url, "/robots.txt"),new CrawlDatum(), true);diff --git a/src/plugin/lib-parsems/src/java/org/apache/nutch/parse/ms/MSBaseParser.java b/src/plugin/lib-parsems/src/java/org/apache/nutch/parse/ms/MSBaseParser.javaindex ced72d186..db458d4fe 100644--- a/src/plugin/lib-parsems/src/java/org/apache/nutch/parse/ms/MSBaseParser.java+++ b/src/plugin/lib-parsems/src/java/org/apache/nutch/parse/ms/MSBaseParser.java@@ -20,11 +20,13 @@ import java.io.ByteArrayInputStream;import java.io.File;import java.io.FileInputStream;import java.util.Properties;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;// Hadoop importsimport org.apache.hadoop.conf.Configuration;-import org.apache.hadoop.util.LogFormatter;// Nutch importsimport org.apache.nutch.metadata.DublinCore;@@ -38,6 +40,7 @@ import org.apache.nutch.parse.ParseImpl;import org.apache.nutch.parse.ParseStatus;import org.apache.nutch.parse.Parser;import org.apache.nutch.protocol.Content;+import org.apache.nutch.util.LogUtil;import org.apache.nutch.util.NutchConfiguration;@@ -50,8 +53,7 @@ public abstract class MSBaseParser implements Parser {private Configuration conf;- protected static final Logger LOG =- LogFormatter.getLogger(MSBaseParser.class.getName());+ protected static final Log LOG = LogFactory.getLog(MSBaseParser.class);/**@@ -135,7 +137,7 @@ public abstract class MSBaseParser implements Parser {fin.close();return buffer;} catch (Exception err) {- err.printStackTrace();+ err.printStackTrace(LogUtil.getErrorStream(LOG));return null;}diff --git a/src/plugin/lib-parsems/src/java/org/apache/nutch/parse/ms/MSExtractor.java b/src/plugin/lib-parsems/src/java/org/apache/nutch/parse/ms/MSExtractor.javaindex 384e52983..42a421c88 100644--- a/src/plugin/lib-parsems/src/java/org/apache/nutch/parse/ms/MSExtractor.java+++ b/src/plugin/lib-parsems/src/java/org/apache/nutch/parse/ms/MSExtractor.java@@ -19,10 +19,10 @@ package org.apache.nutch.parse.ms;import java.io.InputStream;import java.util.Date;import java.util.Properties;-import java.util.logging.Logger;-// Hadoop imports-import org.apache.hadoop.util.LogFormatter;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;// Nutch importsimport org.apache.nutch.metadata.DublinCore;@@ -47,8 +47,7 @@ import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener;*/public abstract class MSExtractor {- protected final static Logger LOG =- LogFormatter.getLogger(MSExtractor.class.getName());+ protected final static Log LOG = LogFactory.getLog(MSExtractor.class);private String text = null;private POIFSReader reader = null;diff --git a/src/plugin/lib-regex-filter/src/java/org/apache/nutch/urlfilter/api/RegexURLFilterBase.java b/src/plugin/lib-regex-filter/src/java/org/apache/nutch/urlfilter/api/RegexURLFilterBase.javaindex ffd379bb2..105d0b61c 100644--- a/src/plugin/lib-regex-filter/src/java/org/apache/nutch/urlfilter/api/RegexURLFilterBase.java+++ b/src/plugin/lib-regex-filter/src/java/org/apache/nutch/urlfilter/api/RegexURLFilterBase.java@@ -23,11 +23,15 @@ import java.io.InputStreamReader;import java.io.IOException;import java.util.List;import java.util.ArrayList;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;// Hadoop importsimport org.apache.hadoop.conf.Configuration;-import org.apache.hadoop.util.LogFormatter;++// Nutch importsimport org.apache.nutch.net.*;@@ -51,8 +55,7 @@ import org.apache.nutch.net.*;public abstract class RegexURLFilterBase implements URLFilter {/** My logger */- private final static Logger LOG =- LogFormatter.getLogger(RegexURLFilterBase.class.getName());+ private final static Log LOG = LogFactory.getLog(RegexURLFilterBase.class);/** An array of applicable rules */private RegexRule[] rules;@@ -131,12 +134,12 @@ public abstract class RegexURLFilterBase implements URLFilter {String file = getRulesFile(conf);Reader reader = conf.getConfResourceAsReader(file);if (reader == null) {- LOG.severe("Can't find resource: " + file);+ LOG.fatal("Can't find resource: " + file);} else {try {rules = readRulesFile(reader);} catch (IOException e) {- LOG.severe(e.getMessage());+ LOG.fatal(e.getMessage());//TODO [email protected]: throw Exception? Because broken api.throw new RuntimeException(e.getMessage(), e);}@@ -184,7 +187,7 @@ public abstract class RegexURLFilterBase implements URLFilter {}String regex = line.substring(1);- LOG.fine("Adding rule [" + regex + "]");+ LOG.trace("Adding rule [" + regex + "]");RegexRule rule = createRule(sign, regex);rules.add(rule);}diff --git a/src/plugin/lib-regex-filter/src/test/org/apache/nutch/urlfilter/api/RegexURLFilterBaseTest.java b/src/plugin/lib-regex-filter/src/test/org/apache/nutch/urlfilter/api/RegexURLFilterBaseTest.javaindex cc926a02c..f2c2860c5 100644--- a/src/plugin/lib-regex-filter/src/test/org/apache/nutch/urlfilter/api/RegexURLFilterBaseTest.java+++ b/src/plugin/lib-regex-filter/src/test/org/apache/nutch/urlfilter/api/RegexURLFilterBaseTest.java@@ -22,13 +22,13 @@ import java.io.IOException;import java.io.Reader;import java.util.ArrayList;import java.util.List;-import java.util.logging.Logger;// JUnit importsimport junit.framework.TestCase;-// Hadoop imports-import org.apache.hadoop.util.LogFormatter;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;// Nutch importsimport org.apache.nutch.net.URLFilter;@@ -42,8 +42,7 @@ import org.apache.nutch.net.URLFilter;public abstract class RegexURLFilterBaseTest extends TestCase {/** My logger */- protected static final Logger LOG =- LogFormatter.getLogger(RegexURLFilterBaseTest.class.getName());+ protected static final Log LOG = LogFactory.getLog(RegexURLFilterBaseTest.class);private final static String SEPARATOR = System.getProperty("file.separator");private final static String SAMPLES = System.getProperty("test.data", ".");diff --git a/src/plugin/microformats-reltag/src/java/org/apache/nutch/microformats/reltag/RelTagParser.java b/src/plugin/microformats-reltag/src/java/org/apache/nutch/microformats/reltag/RelTagParser.javaindex 03cbee5fd..797a691a4 100644--- a/src/plugin/microformats-reltag/src/java/org/apache/nutch/microformats/reltag/RelTagParser.java+++ b/src/plugin/microformats-reltag/src/java/org/apache/nutch/microformats/reltag/RelTagParser.java@@ -21,12 +21,15 @@ import java.net.URLDecoder;import java.util.Iterator;import java.util.Set;import java.util.TreeSet;-import java.util.logging.Logger;import org.w3c.dom.DocumentFragment;import org.w3c.dom.NamedNodeMap;import org.w3c.dom.Node;import org.w3c.dom.NodeList;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+// Nutch importsimport org.apache.nutch.metadata.Metadata;import org.apache.nutch.parse.HTMLMetaTags;@@ -37,7 +40,6 @@ import org.apache.nutch.util.StringUtil;// Hadoop importsimport org.apache.hadoop.conf.Configuration;-import org.apache.hadoop.util.LogFormatter;/**@@ -49,8 +51,7 @@ import org.apache.hadoop.util.LogFormatter;*/public class RelTagParser implements HtmlParseFilter {- public final static Logger LOG =- LogFormatter.getLogger(RelTagParser.class.getName());+ public final static Log LOG = LogFactory.getLog(RelTagParser.class);public final static String REL_TAG = "Rel-Tag";diff --git a/src/plugin/ontology/src/java/org/apache/nutch/ontology/jena/OntologyImpl.java b/src/plugin/ontology/src/java/org/apache/nutch/ontology/jena/OntologyImpl.javaindex 04e205674..8957bad29 100644--- a/src/plugin/ontology/src/java/org/apache/nutch/ontology/jena/OntologyImpl.java+++ b/src/plugin/ontology/src/java/org/apache/nutch/ontology/jena/OntologyImpl.java@@ -17,7 +17,6 @@package org.apache.nutch.ontology.jena;import org.apache.hadoop.conf.Configuration;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.ontology.*;import org.apache.nutch.util.NutchConfiguration;@@ -32,6 +31,9 @@ import com.hp.hpl.jena.rdf.model.Resource;import com.hp.hpl.jena.rdf.model.ModelFactory;import com.hp.hpl.jena.shared.PrefixMapping;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import java.util.Map;import java.util.HashMap;import java.util.Hashtable;@@ -39,7 +41,6 @@ import java.util.Iterator;import java.util.List;import java.util.LinkedList;-import java.util.logging.Logger;import java.io.PrintStream;@@ -51,8 +52,7 @@ import java.io.PrintStream;* @author michael j pan*/public class OntologyImpl implements org.apache.nutch.ontology.Ontology {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.ontology.Ontology");+ public static final Log LOG = LogFactory.getLog("org.apache.nutch.ontology.Ontology");public final static String DELIMITER_SEARCHTERM = " ";@@ -104,11 +104,11 @@ public class OntologyImpl implements org.apache.nutch.ontology.Ontology {LOG.info( "reading "+url);((OntModel)m).read(url);} catch (Exception e) {- LOG.severe("failed on attempting to read ontology "+url);- LOG.severe(e.getMessage());+ LOG.fatal("failed on attempting to read ontology "+url);+ LOG.fatal(e.getMessage());StackTraceElement[] traces = e.getStackTrace();for (int i=0; i<traces.length; i++) {- LOG.severe(traces[i].toString());+ LOG.fatal(traces[i].toString());}}}@@ -332,7 +332,7 @@ public class OntologyImpl implements org.apache.nutch.ontology.Ontology {String urls = conf.get("extension.ontology.urls");if (urls==null || urls.trim().equals("")) {- LOG.severe("No ontology url found.");+ LOG.fatal("No ontology url found.");return;}ontology.load(urls.split("\\s+"));diff --git a/src/plugin/ontology/src/java/org/apache/nutch/ontology/jena/OwlParser.java b/src/plugin/ontology/src/java/org/apache/nutch/ontology/jena/OwlParser.javaindex cec503e47..97e531d78 100644--- a/src/plugin/ontology/src/java/org/apache/nutch/ontology/jena/OwlParser.java+++ b/src/plugin/ontology/src/java/org/apache/nutch/ontology/jena/OwlParser.java@@ -21,13 +21,17 @@ import java.util.Iterator;import java.util.List;import java.util.regex.Matcher;import java.util.regex.Pattern;-//import org.apache.hadoop.util.LogFormatter;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import com.hp.hpl.jena.ontology.OntClass;import com.hp.hpl.jena.ontology.OntModel;import com.hp.hpl.jena.ontology.Individual;import com.hp.hpl.jena.rdf.model.Literal;import org.apache.nutch.ontology.*;+import org.apache.nutch.util.LogUtil;/*** implementation of parser for w3c's OWL files@@ -35,6 +39,9 @@ import org.apache.nutch.ontology.*;* @author michael j pan*/public class OwlParser implements Parser {++ private final static Log LOG = LogFactory.getLog(OwlParser.class);+public OwlParser () {}@@ -123,8 +130,7 @@ public class OwlParser implements Parser {roots.add( c );}} catch (Exception e) {- //e.printStackTrace();- System.out.println(e.getMessage());+ e.printStackTrace(LogUtil.getWarnStream(LOG));}}diff --git a/src/plugin/parse-ext/src/java/org/apache/nutch/parse/ext/ExtParser.java b/src/plugin/parse-ext/src/java/org/apache/nutch/parse/ext/ExtParser.javaindex fa087eeeb..21d72c884 100644--- a/src/plugin/parse-ext/src/java/org/apache/nutch/parse/ext/ExtParser.java+++ b/src/plugin/parse-ext/src/java/org/apache/nutch/parse/ext/ExtParser.java@@ -25,7 +25,6 @@ import org.apache.nutch.parse.ParseImpl;import org.apache.nutch.parse.Outlink;import org.apache.nutch.parse.OutlinkExtractor;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.util.CommandRunner;import org.apache.nutch.metadata.Metadata;import org.apache.nutch.net.protocols.Response;@@ -34,9 +33,10 @@ import org.apache.hadoop.conf.Configuration;import org.apache.nutch.plugin.Extension;import org.apache.nutch.plugin.PluginRepository;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import java.util.Hashtable;-import java.util.logging.Level;-import java.util.logging.Logger;import java.io.ByteArrayInputStream;import java.io.ByteArrayOutputStream;@@ -49,8 +49,7 @@ import java.io.ByteArrayOutputStream;public class ExtParser implements Parser {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.parse.ext");+ public static final Log LOG = LogFactory.getLog("org.apache.nutch.parse.ext");static final int BUFFER_SIZE = 4096;@@ -77,8 +76,9 @@ public class ExtParser implements Parser {String command = params[0];int timeout = Integer.parseInt(params[1]);- if (LOG.isLoggable(Level.FINE))- LOG.fine("Use "+command+ " with timeout="+timeout+"secs");+ if (LOG.isTraceEnabled()) {+ LOG.trace("Use "+command+ " with timeout="+timeout+"secs");+ }String text = null;String title = null;diff --git a/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java b/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.javaindex 6aad529dd..ac97c2be6 100644--- a/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java+++ b/src/plugin/parse-html/src/java/org/apache/nutch/parse/html/HtmlParser.java@@ -17,7 +17,6 @@package org.apache.nutch.parse.html;import java.util.ArrayList;-import java.util.logging.*;import java.net.URL;import java.net.MalformedURLException;import java.io.*;@@ -29,17 +28,18 @@ import org.xml.sax.SAXException;import org.w3c.dom.*;import org.apache.html.dom.*;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.nutch.metadata.Metadata;import org.apache.nutch.net.protocols.Response;import org.apache.nutch.protocol.Content;import org.apache.hadoop.conf.*;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.parse.*;import org.apache.nutch.util.*;public class HtmlParser implements Parser {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.parse.html");+ public static final Log LOG = LogFactory.getLog("org.apache.nutch.parse.html");// I used 1000 bytes at first, but found that some documents have// meta tag well past the first 1000 bytes.@@ -126,7 +126,7 @@ public class HtmlParser implements Parser {metadata.set(Metadata.ORIGINAL_CHAR_ENCODING, encoding);if ((encoding = StringUtil.resolveEncodingAlias(encoding)) != null) {metadata.set(Metadata.CHAR_ENCODING_FOR_CONVERSION, encoding);- LOG.fine(base + ": setting encoding to " + encoding);+ LOG.trace(base + ": setting encoding to " + encoding);}}@@ -137,7 +137,7 @@ public class HtmlParser implements Parser {metadata.set(Metadata.ORIGINAL_CHAR_ENCODING, encoding);if ((encoding = StringUtil.resolveEncodingAlias(encoding)) != null) {metadata.set(Metadata.CHAR_ENCODING_FOR_CONVERSION, encoding);- LOG.fine(base + ": setting encoding to " + encoding);+ LOG.trace(base + ": setting encoding to " + encoding);}}}@@ -151,10 +151,10 @@ public class HtmlParser implements Parser {// same share)encoding = defaultCharEncoding;metadata.set(Metadata.CHAR_ENCODING_FOR_CONVERSION, defaultCharEncoding);- LOG.fine(base + ": falling back to " + defaultCharEncoding);+ LOG.trace(base + ": falling back to " + defaultCharEncoding);}input.setEncoding(encoding);- LOG.fine("Parsing...");+ LOG.trace("Parsing...");root = parse(input);} catch (IOException e) {return new ParseStatus(e).getEmptyParse(getConf());@@ -163,21 +163,21 @@ public class HtmlParser implements Parser {} catch (SAXException e) {return new ParseStatus(e).getEmptyParse(getConf());} catch (Exception e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));return new ParseStatus(e).getEmptyParse(getConf());}// get meta directivesHTMLMetaProcessor.getMetaTags(metaTags, root, base);- LOG.fine("Meta tags for " + base + ": " + metaTags.toString());+ LOG.trace("Meta tags for " + base + ": " + metaTags.toString());// check meta directivesif (!metaTags.getNoIndex()) { // okay to indexStringBuffer sb = new StringBuffer();- LOG.fine("Getting text...");+ LOG.trace("Getting text...");utils.getText(sb, root); // extract texttext = sb.toString();sb.setLength(0);- LOG.fine("Getting title...");+ LOG.trace("Getting title...");utils.getTitle(sb, root); // extract titletitle = sb.toString().trim();}@@ -185,10 +185,10 @@ public class HtmlParser implements Parser {if (!metaTags.getNoFollow()) { // okay to follow linksArrayList l = new ArrayList(); // extract outlinksURL baseTag = utils.getBase(root);- LOG.fine("Getting links...");+ LOG.trace("Getting links...");utils.getOutlinks(baseTag!=null?baseTag:base, l, root);outlinks = (Outlink[])l.toArray(new Outlink[l.size()]);- LOG.fine("found "+outlinks.length+" outlinks in "+content.getUrl());+ LOG.trace("found "+outlinks.length+" outlinks in "+content.getUrl());}if (!metaTags.getNoCache()) { // okay to cache@@ -259,12 +259,12 @@ public class HtmlParser implements Parser {LOG.info(" - new frag, " + frag.getChildNodes().getLength() + " nodes.");res.appendChild(frag);}- } catch (Exception x) { x.printStackTrace();};+ } catch (Exception x) { x.printStackTrace(LogUtil.getWarnStream(LOG));};return res;}public static void main(String[] args) throws Exception {- LOG.setLevel(Level.FINE);+ //LOG.setLevel(Level.FINE);String name = args[0];String url = "file:"+name;File file = new File(name);diff --git a/src/plugin/parse-js/src/java/org/apache/nutch/parse/js/JSParseFilter.java b/src/plugin/parse-js/src/java/org/apache/nutch/parse/js/JSParseFilter.javaindex 74e5280cd..42290664c 100644--- a/src/plugin/parse-js/src/java/org/apache/nutch/parse/js/JSParseFilter.java+++ b/src/plugin/parse-js/src/java/org/apache/nutch/parse/js/JSParseFilter.java@@ -8,7 +8,9 @@ import java.net.URL;import java.util.ArrayList;import java.util.Arrays;import java.util.List;-import java.util.logging.Logger;++import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.nutch.parse.HTMLMetaTags;import org.apache.nutch.parse.HtmlParseFilter;@@ -20,7 +22,6 @@ import org.apache.nutch.parse.ParseStatus;import org.apache.nutch.parse.Parser;import org.apache.nutch.protocol.Content;import org.apache.nutch.util.NutchConfiguration;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;import org.apache.oro.text.regex.MatchResult;import org.apache.oro.text.regex.Pattern;@@ -44,8 +45,7 @@ import org.w3c.dom.NodeList;* @author Andrzej Bialecki <[email protected]>*/public class JSParseFilter implements HtmlParseFilter, Parser {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.parse.js.JSParseFilter");+ public static final Log LOG = LogFactory.getLog(JSParseFilter.class);private static final int MAX_TITLE_LEN = 80;@@ -164,7 +164,7 @@ public class JSParseFilter implements HtmlParseFilter, Parser {try {baseURL = new URL(base);} catch (Exception e) {- LOG.throwing(JSParseFilter.class.getName(), "getJSLinks", e);+ LOG.error("getJSLinks", e);}try {@@ -189,20 +189,20 @@ public class JSParseFilter implements HtmlParseFilter, Parser {url = result.group(2);PatternMatcherInput input1 = new PatternMatcherInput(url);if (!matcher1.matches(input1, pattern1)) {- //LOG.fine(" - invalid '" + url + "'");+ //LOG.trace(" - invalid '" + url + "'");continue;}if (url.startsWith("www.")) {url = "http://" + url;} else url = new URL(baseURL, url).toString();url = url.replaceAll("&", "&");- LOG.fine(" - outlink from JS: '" + url + "'");+ LOG.trace(" - outlink from JS: '" + url + "'");outlinks.add(new Outlink(url, anchor, getConf()));}} catch (Exception ex) {// if it is a malformed URL we just throw it away and continue with// extraction.- LOG.throwing(JSParseFilter.class.getName(), "getJSLinks", ex);+ LOG.error("getJSLinks", ex);}final Outlink[] retval;diff --git a/src/plugin/parse-mspowerpoint/src/java/org/apache/nutch/parse/mspowerpoint/ContentReaderListener.java b/src/plugin/parse-mspowerpoint/src/java/org/apache/nutch/parse/mspowerpoint/ContentReaderListener.javaindex 48615ca48..6cd0db1e4 100644--- a/src/plugin/parse-mspowerpoint/src/java/org/apache/nutch/parse/mspowerpoint/ContentReaderListener.java+++ b/src/plugin/parse-mspowerpoint/src/java/org/apache/nutch/parse/mspowerpoint/ContentReaderListener.java@@ -19,9 +19,10 @@ import java.util.Enumeration;import java.util.Hashtable;import java.util.List;import java.util.Vector;-import java.util.logging.Logger;-import org.apache.hadoop.util.LogFormatter;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.poi.hdf.extractor.Utils;import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent;import org.apache.poi.poifs.eventfilesystem.POIFSReaderListener;@@ -40,8 +41,7 @@ import org.apache.poi.util.StringUtil;*/class ContentReaderListener implements POIFSReaderListener {- private static final Logger LOG = LogFormatter- .getLogger(ContentReaderListener.class.getName());+ private static final Log LOG = LogFactory.getLog(ContentReaderListener.class);/** Buffer holding the content of the file */protected final transient StringBuffer buf;@@ -65,8 +65,8 @@ class ContentReaderListener implements POIFSReaderListener {if (event == null || event.getName() == null|| !event.getName().startsWith(PPTConstants.POWERPOINT_DOCUMENT)) {- LOG.warning("Stream not processed. It is not a PowerPoint document: : "- + event.getName());+ LOG.warn("Stream not processed. It is not a PowerPoint document: : "+ + event.getName());return;}@@ -108,14 +108,14 @@ class ContentReaderListener implements POIFSReaderListener {containerTextBox = extractTextBoxes(containerTextBox, offset,pptdata, offsetPD);} else if (PPTConstants.PPT_ATOM_DRAWINGGROUP == type) {- // LOG.finest("PPT_DRAWINGGROUP_ATOM ignored: " + type);+ // LOG.trace("PPT_DRAWINGGROUP_ATOM ignored: " + type);} else if (PPTConstants.PPT_ATOM_TEXTBYTE == type) {- // LOG.finest("PPT_TEXTBYTE_ATOM ignored: " + type);+ // LOG.trace("PPT_TEXTBYTE_ATOM ignored: " + type);} else if (PPTConstants.PPT_ATOM_TEXTCHAR == type) {- // LOG.finest("PPT_TEXTCHAR_ATOM ignored: " + type);+ // LOG.trace("PPT_TEXTCHAR_ATOM ignored: " + type);} else {// no action- // LOG.finest("type not handled: " + type);+ // LOG.trace("type not handled: " + type);}}@@ -158,7 +158,7 @@ class ContentReaderListener implements POIFSReaderListener {}} catch (Throwable ex) {// because of not killing complete crawling all Throwables are catched.- LOG.throwing(this.getClass().getName(), "processPOIFSReaderEvent", ex);+ LOG.error("processPOIFSReaderEvent", ex);}}@@ -205,7 +205,7 @@ class ContentReaderListener implements POIFSReaderListener {if (currentID == PPTConstants.PPT_MASTERSLIDE) {// Ignore Master Slide objects- LOG.finest("Ignore master slide.");+ LOG.trace("Ignore master slide.");i++;continue;}@@ -226,7 +226,7 @@ class ContentReaderListener implements POIFSReaderListener {*/if ((offsetPD - 20) != recordSize) {// TODO something wrong? Probably an OLE-Object, which we ignore.- LOG.finer("offsetPD - 20=" + (offsetPD - 20) + " recordsize="+ LOG.debug("offsetPD - 20=" + (offsetPD - 20) + " recordsize="+ recordSize);} else {for (int startPos = i + 8; startPos < offsetPD - 20@@ -290,10 +290,10 @@ class ContentReaderListener implements POIFSReaderListener {} else {// ignored- // LOG.finest("Ignored atom type: " + type);+ // LOG.trace("Ignored atom type: " + type);}} catch (Throwable e) {- LOG.throwing(this.getClass().getName(), "extractTextBoxes", e);+ LOG.error("extractTextBoxes", e);break;}}@@ -302,10 +302,10 @@ class ContentReaderListener implements POIFSReaderListener {/** Record type is ignored*/- // LOG.finest("Ignored record type: " + type);+ // LOG.trace("Ignored record type: " + type);}} catch (Throwable ee) {- LOG.throwing(this.getClass().getName(), "extractClientTextBoxes", ee);+ LOG.error("extractClientTextBoxes", ee);break;}}@@ -355,8 +355,8 @@ class ContentReaderListener implements POIFSReaderListener {byte value = pptdata[(int) ii + 2];outStream.write(value);} catch (ArrayIndexOutOfBoundsException ex) {- LOG.finest("size=" + pptdata.length);- LOG.throwing(this.getClass().getName(), "extractSlides", ex);+ LOG.trace("size=" + pptdata.length);+ LOG.error("extractSlides", ex);}}@@ -401,11 +401,11 @@ class ContentReaderListener implements POIFSReaderListener {/** Diagram records are ignored*/- LOG.finest("Drawing Groups are ignored.");+ LOG.trace("Drawing Groups are ignored.");break;} else {// ignored- // LOG.finest("Unhandled atomType: " + atomType);+ // LOG.trace("Unhandled atomType: " + atomType);}}diff --git a/src/plugin/parse-mspowerpoint/src/java/org/apache/nutch/parse/mspowerpoint/PPTExtractor.java b/src/plugin/parse-mspowerpoint/src/java/org/apache/nutch/parse/mspowerpoint/PPTExtractor.javaindex d53f5f2e4..b5cbeb585 100644--- a/src/plugin/parse-mspowerpoint/src/java/org/apache/nutch/parse/mspowerpoint/PPTExtractor.java+++ b/src/plugin/parse-mspowerpoint/src/java/org/apache/nutch/parse/mspowerpoint/PPTExtractor.java@@ -48,7 +48,7 @@ class PPTExtractor extends MSExtractor {if (input.available() > 0) {this.reader.read(input);} else {- LOG.warning("Input <=0 :" + input.available());+ LOG.warn("Input <=0 :" + input.available());}return (this.text != null) ? text.toString() : null;}diff --git a/src/plugin/parse-mspowerpoint/src/test/org/apache/nutch/parse/mspowerpoint/TestMSPowerPointParser.java b/src/plugin/parse-mspowerpoint/src/test/org/apache/nutch/parse/mspowerpoint/TestMSPowerPointParser.javaindex e6b72511e..eb64b5e56 100644--- a/src/plugin/parse-mspowerpoint/src/test/org/apache/nutch/parse/mspowerpoint/TestMSPowerPointParser.java+++ b/src/plugin/parse-mspowerpoint/src/test/org/apache/nutch/parse/mspowerpoint/TestMSPowerPointParser.java@@ -23,17 +23,18 @@ import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStreamReader;import java.io.OutputStreamWriter;-import java.util.logging.Logger;import junit.framework.TestCase;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.nutch.parse.Parse;import org.apache.nutch.parse.ParseData;import org.apache.nutch.parse.ParseUtil;import org.apache.nutch.protocol.Content;import org.apache.nutch.protocol.Protocol;import org.apache.nutch.protocol.ProtocolFactory;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.util.NutchConfiguration;import org.apache.hadoop.io.UTF8;@@ -54,8 +55,7 @@ import org.apache.nutch.crawl.CrawlDatum;* @version 1.0*/public class TestMSPowerPointParser extends TestCase {- private static final Logger LOG = LogFormatter- .getLogger(TestMSPowerPointParser.class.getName());+ private static final Log LOG = LogFactory.getLog(TestMSPowerPointParser.class);private static final String CHARSET = "UTF-8";diff --git a/src/plugin/parse-oo/src/java/org/apache/nutch/parse/oo/OOParser.java b/src/plugin/parse-oo/src/java/org/apache/nutch/parse/oo/OOParser.javaindex dedabef1c..a272cfb28 100644--- a/src/plugin/parse-oo/src/java/org/apache/nutch/parse/oo/OOParser.java+++ b/src/plugin/parse-oo/src/java/org/apache/nutch/parse/oo/OOParser.java@@ -20,14 +20,16 @@ import java.io.*;import java.net.MalformedURLException;import java.util.ArrayList;import java.util.List;-import java.util.logging.Logger;import java.util.zip.*;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.hadoop.conf.Configuration;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.metadata.Metadata;import org.apache.nutch.parse.*;import org.apache.nutch.protocol.Content;+import org.apache.nutch.util.LogUtil;import org.apache.nutch.util.NutchConfiguration;import org.jaxen.*;import org.jaxen.jdom.JDOMXPath;@@ -42,8 +44,7 @@ import org.jdom.input.*;* @author Andrzej Bialecki*/public class OOParser implements Parser {- public static final Logger LOG =- LogFormatter.getLogger(OOParser.class.getName());+ public static final Log LOG = LogFactory.getLog(OOParser.class);private Configuration conf;@@ -84,7 +85,7 @@ public class OOParser implements Parser {}zis.close();} catch (Exception e) { // run time exception- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));return new ParseStatus(ParseStatus.FAILED,"Can't be handled as OO document. " + e).getEmptyParse(conf);}@@ -215,4 +216,4 @@ public class OOParser implements Parser {osw.close();*/}-}\ No newline at end of file+}diff --git a/src/plugin/parse-pdf/src/java/org/apache/nutch/parse/pdf/PdfParser.java b/src/plugin/parse-pdf/src/java/org/apache/nutch/parse/pdf/PdfParser.javaindex cf0a6827f..aba318996 100644--- a/src/plugin/parse-pdf/src/java/org/apache/nutch/parse/pdf/PdfParser.java+++ b/src/plugin/parse-pdf/src/java/org/apache/nutch/parse/pdf/PdfParser.java@@ -25,10 +25,13 @@ import org.pdfbox.util.PDFTextStripper;import org.pdfbox.exceptions.CryptographyException;import org.pdfbox.exceptions.InvalidPasswordException;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.nutch.protocol.Content;import org.apache.nutch.metadata.Metadata;import org.apache.nutch.net.protocols.Response;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;import org.apache.nutch.parse.ParseStatus;import org.apache.nutch.parse.Parser;@@ -37,12 +40,11 @@ import org.apache.nutch.parse.ParseData;import org.apache.nutch.parse.ParseImpl;import org.apache.nutch.parse.Outlink;import org.apache.nutch.parse.OutlinkExtractor;+import org.apache.nutch.util.LogUtil;import java.text.SimpleDateFormat;import java.util.Calendar;-import java.util.logging.Logger;-import java.io.ByteArrayInputStream;import java.io.IOException;@@ -60,29 +62,9 @@ import java.io.IOException;*********************************************/public class PdfParser implements Parser {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.parse.pdf");+ public static final Log LOG = LogFactory.getLog("org.apache.nutch.parse.pdf");private Configuration conf;- public PdfParser () {- // redirect org.apache.log4j.Logger to java's native logger, in order- // to, at least, suppress annoying log4j warnings.- // Note on 20040614 by Xing:- // log4j is used by pdfbox. This snippet'd better be moved- // to a common place shared by all parsers that use log4j.- org.apache.log4j.Logger rootLogger =- org.apache.log4j.Logger.getRootLogger();-- rootLogger.setLevel(org.apache.log4j.Level.INFO);-- org.apache.log4j.Appender appender = new org.apache.log4j.WriterAppender(- new org.apache.log4j.SimpleLayout(),- org.apache.hadoop.util.LogFormatter.getLogStream(- this.LOG, java.util.logging.Level.INFO));-- rootLogger.addAppender(appender);- }-public Parse getParse(Content content) {// in memory representation of pdf file@@ -143,8 +125,8 @@ public class PdfParser implements Parser {return new ParseStatus(ParseStatus.FAILED,"Can't decrypt document - invalid password. " + e).getEmptyParse(getConf());} catch (Exception e) { // run time exception- LOG.warning("General exception in PDF parser: "+e.getMessage());- e.printStackTrace();+ LOG.warn("General exception in PDF parser: "+e.getMessage());+ e.printStackTrace(LogUtil.getWarnStream(LOG));return new ParseStatus(ParseStatus.FAILED,"Can't be handled as pdf document. " + e).getEmptyParse(getConf());} finally {diff --git a/src/plugin/parse-rss/src/java/org/apache/nutch/parse/rss/RSSParser.java b/src/plugin/parse-rss/src/java/org/apache/nutch/parse/rss/RSSParser.javaindex abdc3dd22..2f4a16644 100644--- a/src/plugin/parse-rss/src/java/org/apache/nutch/parse/rss/RSSParser.java+++ b/src/plugin/parse-rss/src/java/org/apache/nutch/parse/rss/RSSParser.java@@ -19,14 +19,15 @@ package org.apache.nutch.parse.rss;// JDK importsimport java.io.ByteArrayInputStream;import java.net.MalformedURLException;-import java.util.logging.Logger;import java.util.List;import java.util.Vector;-import java.util.logging.Level;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;// Hadoop importsimport org.apache.hadoop.io.UTF8;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;// Nutch imports@@ -42,6 +43,7 @@ import org.apache.nutch.parse.rss.structs.RSSChannel;import org.apache.nutch.protocol.Content;import org.apache.nutch.protocol.Protocol;import org.apache.nutch.protocol.ProtocolFactory;+import org.apache.nutch.util.LogUtil;import org.apache.nutch.util.NutchConfiguration;// RSS parsing imports@@ -60,35 +62,9 @@ import org.apache.commons.feedparser.FeedParserFactory;* </p>*/public class RSSParser implements Parser {- public static final Logger LOG = LogFormatter- .getLogger("org.apache.nutch.parse.rss");+ public static final Log LOG = LogFactory.getLog("org.apache.nutch.parse.rss");private Configuration conf;- /**- * <p>- * Default Constructor- * </p>- */- public RSSParser() {-- // redirect org.apache.log4j.Logger to java's native logger, in order- // to, at least, suppress annoying log4j warnings.- // Note on 20040614 by Xing:- // log4j is used by pdfbox. This snippet'd better be moved- // to a common place shared by all parsers that use log4j.- org.apache.log4j.Logger rootLogger = org.apache.log4j.Logger- .getRootLogger();-- rootLogger.setLevel(org.apache.log4j.Level.INFO);-- org.apache.log4j.Appender appender = new org.apache.log4j.WriterAppender(- new org.apache.log4j.SimpleLayout(),- org.apache.hadoop.util.LogFormatter.getLogStream(this.LOG,- java.util.logging.Level.INFO));-- rootLogger.addAppender(appender);- }-/*** <p>* Implementation method, parses the RSS content, and then returns a@@ -119,8 +95,8 @@ public class RSSParser implements Parser {theRSSChannels = ((FeedParserListenerImpl) listener).getChannels();} catch (Exception e) { // run time exception- e.printStackTrace();- LOG.fine("nutch:parse-rss:RSSParser Exception: " + e.getMessage());+ e.printStackTrace(LogUtil.getWarnStream(LOG));+ LOG.trace("nutch:parse-rss:RSSParser Exception: " + e.getMessage());return new ParseStatus(ParseStatus.FAILED,"Can't be handled as rss document. " + e).getEmptyParse(getConf());}@@ -157,7 +133,7 @@ public class RSSParser implements Parser {LOG.info("nutch:parse-rss:RSSParser Exception: MalformedURL: "+ r.getLink()+ ": Attempting to continue processing outlinks");- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));continue;}}@@ -187,7 +163,7 @@ public class RSSParser implements Parser {LOG.info("nutch:parse-rss:RSSParser Exception: MalformedURL: "+ whichLink+ ": Attempting to continue processing outlinks");- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));continue;}}@@ -196,17 +172,17 @@ public class RSSParser implements Parser {}- LOG.fine("nutch:parse-rss:getParse:indexText=" + indexText);- LOG.fine("nutch:parse-rss:getParse:contentTitle=" + contentTitle);+ LOG.trace("nutch:parse-rss:getParse:indexText=" + indexText);+ LOG.trace("nutch:parse-rss:getParse:contentTitle=" + contentTitle);} else {- LOG.fine("nutch:parse-rss:Error:getParse: No RSS Channels recorded!");+ LOG.trace("nutch:parse-rss:Error:getParse: No RSS Channels recorded!");}// format the outlinksOutlink[] outlinks = (Outlink[]) theOutlinks.toArray(new Outlink[theOutlinks.size()]);- LOG.fine("nutch:parse-rss:getParse:found " + outlinks.length + " outlinks");+ LOG.trace("nutch:parse-rss:getParse:found " + outlinks.length + " outlinks");// LOG.info("Outlinks: "+outlinks);ParseData parseData = new ParseData(ParseStatus.STATUS_SUCCESS,@@ -224,7 +200,7 @@ public class RSSParser implements Parser {}public static void main(String[] args) throws Exception {- LOG.setLevel(Level.FINE);+ //LOG.setLevel(Level.FINE);String url = args[0];Configuration conf = NutchConfiguration.create();RSSParser parser = new RSSParser();diff --git a/src/plugin/parse-swf/src/java/org/apache/nutch/parse/swf/SWFParser.java b/src/plugin/parse-swf/src/java/org/apache/nutch/parse/swf/SWFParser.javaindex 9cca6578a..cb1e10fb2 100644--- a/src/plugin/parse-swf/src/java/org/apache/nutch/parse/swf/SWFParser.java+++ b/src/plugin/parse-swf/src/java/org/apache/nutch/parse/swf/SWFParser.java@@ -19,16 +19,18 @@ package org.apache.nutch.parse.swf;import java.io.FileInputStream;import java.io.IOException;import java.util.*;-import java.util.logging.Logger;++import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.nutch.metadata.Metadata;import org.apache.nutch.net.protocols.Response;import org.apache.nutch.parse.*;import org.apache.nutch.protocol.Content;+import org.apache.nutch.util.LogUtil;+import org.apache.nutch.util.NutchConfiguration;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;-import org.apache.nutch.util.NutchConfiguration;import com.anotherbigidea.flash.interfaces.*;import com.anotherbigidea.flash.readers.*;@@ -44,7 +46,7 @@ import com.anotherbigidea.io.InStream;* @author Andrzej Bialecki*/public class SWFParser implements Parser {- public static final Logger LOG = LogFormatter.getLogger("org.apache.nutch.parse.swf");+ public static final Log LOG = LogFactory.getLog("org.apache.nutch.parse.swf");private Configuration conf = null;@@ -99,7 +101,7 @@ public class SWFParser implements Parser {outlinks.add(olinks[i]);}} catch (Exception e) { // run time exception- e.printStackTrace();+ e.printStackTrace(LogUtil.getErrorStream(LOG));return new ParseStatus(ParseStatus.FAILED, "Can't be handled as SWF document. " + e).getEmptyParse(conf);} finally {}if (text == null) text = "";diff --git a/src/plugin/parse-zip/src/java/org/apache/nutch/parse/zip/ZipParser.java b/src/plugin/parse-zip/src/java/org/apache/nutch/parse/zip/ZipParser.javaindex e534ccb19..bb0323e39 100644--- a/src/plugin/parse-zip/src/java/org/apache/nutch/parse/zip/ZipParser.java+++ b/src/plugin/parse-zip/src/java/org/apache/nutch/parse/zip/ZipParser.java@@ -19,10 +19,12 @@ package org.apache.nutch.parse.zip;import java.io.ByteArrayInputStream;import java.io.InputStream;import java.util.Properties;-import java.util.logging.Logger;import java.util.ArrayList;import java.util.List;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.nutch.metadata.Metadata;import org.apache.nutch.net.protocols.Response;import org.apache.nutch.parse.Outlink;@@ -32,7 +34,6 @@ import org.apache.nutch.parse.ParseImpl;import org.apache.nutch.parse.ParseStatus;import org.apache.nutch.parse.Parser;import org.apache.nutch.protocol.Content;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;/**@@ -43,8 +44,7 @@ import org.apache.hadoop.conf.Configuration;*/public class ZipParser implements Parser {- private static final Logger LOG = LogFormatter.getLogger(ZipParser.class- .getName());+ private static final Log LOG = LogFactory.getLog(ZipParser.class);private Configuration conf;/** Creates a new instance of ZipParser */@@ -62,7 +62,7 @@ public class ZipParser implements Parser {try {final String contentLen = content.getMetadata().get(Response.CONTENT_LENGTH);final int len = Integer.parseInt(contentLen);- System.out.println("ziplen: " + len);+ LOG.debug("ziplen: " + len);final byte[] contentInBytes = content.getContent();final ByteArrayInputStream bainput = new ByteArrayInputStream(contentInBytes);@@ -101,7 +101,7 @@ public class ZipParser implements Parser {content.getMetadata());parseData.setConf(this.conf);- LOG.finest("Zip file parsed sucessfully !!");+ LOG.trace("Zip file parsed sucessfully !!");return new ParseImpl(resultText, parseData);}diff --git a/src/plugin/parse-zip/src/java/org/apache/nutch/parse/zip/ZipTextExtractor.java b/src/plugin/parse-zip/src/java/org/apache/nutch/parse/zip/ZipTextExtractor.javaindex 2da377160..06a55db07 100644--- a/src/plugin/parse-zip/src/java/org/apache/nutch/parse/zip/ZipTextExtractor.java+++ b/src/plugin/parse-zip/src/java/org/apache/nutch/parse/zip/ZipTextExtractor.java@@ -20,11 +20,17 @@ package org.apache.nutch.parse.zip;import java.io.IOException;import java.io.InputStream;import java.util.List;-import java.util.logging.Logger;import java.util.zip.ZipEntry;import java.util.zip.ZipInputStream;import java.net.URL;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;++// Hadoop imports+import org.apache.hadoop.conf.Configuration;+// Nutch importsimport org.apache.nutch.metadata.Metadata;import org.apache.nutch.net.protocols.Response;@@ -34,8 +40,6 @@ import org.apache.nutch.parse.ParseUtil;import org.apache.nutch.parse.ParseException;import org.apache.nutch.parse.Outlink;import org.apache.nutch.protocol.Content;-import org.apache.hadoop.util.LogFormatter;-import org.apache.hadoop.conf.Configuration;import org.apache.nutch.util.mime.MimeTypes;@@ -48,7 +52,7 @@ public class ZipTextExtractor {/** Get the MimeTypes resolver instance. */private MimeTypes MIME;- public static final Logger LOG = LogFormatter.getLogger(ZipTextExtractor.class.getName());+ public static final Log LOG = LogFactory.getLog(ZipTextExtractor.class);private Configuration conf;diff --git a/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/File.java b/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/File.javaindex 35d4a32a7..eaf564c0f 100644--- a/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/File.java+++ b/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/File.java@@ -16,6 +16,8 @@package org.apache.nutch.protocol.file;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.nutch.crawl.CrawlDatum;import org.apache.hadoop.io.UTF8;@@ -23,7 +25,6 @@ import org.apache.nutch.metadata.Metadata;import org.apache.nutch.net.protocols.HttpDateFormat;import org.apache.nutch.net.protocols.Response;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;import org.apache.nutch.protocol.Content;@@ -31,9 +32,6 @@ import org.apache.nutch.protocol.Protocol;import org.apache.nutch.protocol.ProtocolOutput;import org.apache.nutch.protocol.ProtocolStatus;-import java.util.logging.Level;-import java.util.logging.Logger;-import java.net.URL;/************************************@@ -46,8 +44,7 @@ import java.net.URL;***********************************/public class File implements Protocol {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.protocol.file.File");+ public static final Log LOG = LogFactory.getLog(File.class);static final int MAX_REDIRECTS = 5;@@ -91,8 +88,9 @@ public class File implements Protocol {throw new FileException("Too many redirects: " + url);u = new URL(response.getHeader("Location"));redirects++;- if (LOG.isLoggable(Level.FINE))- LOG.fine("redirect to " + u);+ if (LOG.isTraceEnabled()) {+ LOG.trace("redirect to " + u);+ }} else { // convert to exceptionthrow new FileError(code);@@ -141,7 +139,7 @@ public class File implements Protocol {file.setMaxContentLength(maxContentLength);// set log level- LOG.setLevel(Level.parse((new String(logLevel)).toUpperCase()));+ //LOG.setLevel(Level.parse((new String(logLevel)).toUpperCase()));Content content = file.getProtocolOutput(new UTF8(urlString), new CrawlDatum()).getContent();diff --git a/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/FileResponse.java b/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/FileResponse.javaindex cbf5c072f..8f9bc7f86 100644--- a/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/FileResponse.java+++ b/src/plugin/protocol-file/src/java/org/apache/nutch/protocol/file/FileResponse.java@@ -20,7 +20,6 @@ package org.apache.nutch.protocol.file;import java.net.URL;import java.util.Date;import java.util.TreeMap;-import java.util.logging.Level;import java.io.IOException;// Nutch imports@@ -97,11 +96,13 @@ public class FileResponse {if (!"file".equals(url.getProtocol()))throw new FileException("Not a file url:" + url);- if (File.LOG.isLoggable(Level.FINE))- File.LOG.fine("fetching " + url);+ if (File.LOG.isTraceEnabled()) {+ File.LOG.trace("fetching " + url);+ }- if (url.getPath() != url.getFile())- File.LOG.warning("url.getPath() != url.getFile(): " + url);+ if (url.getPath() != url.getFile()) {+ File.LOG.warn("url.getPath() != url.getFile(): " + url);+ }String path = "".equals(url.getPath()) ? "/" : url.getPath();@@ -179,7 +180,7 @@ public class FileResponse {offset += n;}if (offset < len) // keep whatever already have, but issue a warning- File.LOG.warning("not enough bytes read from file: "+f.getPath());+ File.LOG.warn("not enough bytes read from file: "+f.getPath());is.close();// set headersdiff --git a/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/Ftp.java b/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/Ftp.javaindex 58f1477fc..a4d629f9e 100644--- a/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/Ftp.java+++ b/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/Ftp.java@@ -16,6 +16,8 @@package org.apache.nutch.protocol.ftp;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.commons.net.ftp.FTPFileEntryParser;@@ -24,7 +26,6 @@ import org.apache.hadoop.io.UTF8;import org.apache.nutch.net.protocols.HttpDateFormat;import org.apache.nutch.net.protocols.Response;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;import org.apache.nutch.protocol.Content;@@ -32,9 +33,6 @@ import org.apache.nutch.protocol.Protocol;import org.apache.nutch.protocol.ProtocolOutput;import org.apache.nutch.protocol.ProtocolStatus;-import java.util.logging.Level;-import java.util.logging.Logger;-import java.net.URL;import java.io.IOException;@@ -49,8 +47,7 @@ import java.io.IOException;***********************************/public class Ftp implements Protocol {- public static final Logger LOG =- LogFormatter.getLogger("org.apache.nutch.protocol.ftp.Ftp");+ public static final Log LOG = LogFactory.getLog(Ftp.class);static final int BUFFER_SIZE = 16384; // 16*1024 = 16384@@ -135,9 +132,9 @@ public class Ftp implements Protocol {throw new FtpException("Too many redirects: " + url);u = new URL(response.getHeader("Location"));redirects++;- if (LOG.isLoggable(Level.FINE))- LOG.fine("redirect to " + u);-+ if (LOG.isTraceEnabled()) {+ LOG.trace("redirect to " + u);+ }} else { // convert to exceptionthrow new FtpError(code);}@@ -208,7 +205,7 @@ public class Ftp implements Protocol {ftp.setMaxContentLength(maxContentLength);// set log level- LOG.setLevel(Level.parse((new String(logLevel)).toUpperCase()));+ //LOG.setLevel(Level.parse((new String(logLevel)).toUpperCase()));Content content = ftp.getProtocolOutput(new UTF8(urlString), new CrawlDatum()).getContent();diff --git a/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/FtpResponse.java b/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/FtpResponse.javaindex a75e7c388..76b62df38 100644--- a/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/FtpResponse.java+++ b/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/FtpResponse.java@@ -36,7 +36,6 @@ import java.net.URL;import java.util.List;import java.util.LinkedList;-import java.util.logging.Level;import java.io.ByteArrayOutputStream;import java.io.IOException;@@ -94,7 +93,7 @@ public class FtpResponse {throw new FtpException("Not a ftp url:" + url);if (url.getPath() != url.getFile())- Ftp.LOG.warning("url.getPath() != url.getFile(): " + url);+ Ftp.LOG.warn("url.getPath() != url.getFile(): " + url);String path = "".equals(url.getPath()) ? "/" : url.getPath();@@ -103,8 +102,9 @@ public class FtpResponse {if (ftp.followTalk) {Ftp.LOG.info("fetching "+url);} else {- if (Ftp.LOG.isLoggable(Level.FINE))- Ftp.LOG.fine("fetching "+url);+ if (Ftp.LOG.isTraceEnabled()) {+ Ftp.LOG.trace("fetching "+url);+ }}InetAddress addr = InetAddress.getByName(url.getHost());@@ -160,7 +160,7 @@ public class FtpResponse {ftp.client.connect(addr);if (!FTPReply.isPositiveCompletion(ftp.client.getReplyCode())) {ftp.client.disconnect();- Ftp.LOG.warning("ftp.client.connect() failed: "+ Ftp.LOG.warn("ftp.client.connect() failed: "+ addr + " " + ftp.client.getReplyString());this.code = 500; // http Internal Server Errorreturn;@@ -176,7 +176,7 @@ public class FtpResponse {// but throw exception, which then will be handled by caller// (not dealt with here at all) .ftp.client.disconnect();- Ftp.LOG.warning("ftp.client.login() failed: "+addr);+ Ftp.LOG.warn("ftp.client.login() failed: "+addr);this.code = 401; // http Unauthorizedreturn;}@@ -185,7 +185,7 @@ public class FtpResponse {if (!ftp.client.setFileType(FTP.BINARY_FILE_TYPE)) {ftp.client.logout();ftp.client.disconnect();- Ftp.LOG.warning("ftp.client.setFileType() failed: "+addr);+ Ftp.LOG.warn("ftp.client.setFileType() failed: "+addr);this.code = 500; // http Internal Server Errorreturn;}@@ -203,18 +203,18 @@ public class FtpResponse {ftp.parser = (new DefaultFTPFileEntryParserFactory()).createFileEntryParser(parserKey);} catch (FtpExceptionBadSystResponse e) {- Ftp.LOG.warning("ftp.client.getSystemName() failed: "+addr+" "+e);+ Ftp.LOG.warn("ftp.client.getSystemName() failed: "+addr+" "+e);ftp.parser = null;} catch (ParserInitializationException e) {// ParserInitializationException is RuntimeException defined in// org.apache.commons.net.ftp.parser.ParserInitializationException- Ftp.LOG.warning("createFileEntryParser() failed. "+addr+" "+e);+ Ftp.LOG.warn("createFileEntryParser() failed. "+addr+" "+e);ftp.parser = null;} finally {if (ftp.parser == null) {// do not log as severe, otherwise// FetcherThread/RequestScheduler will abort- Ftp.LOG.warning("ftp.parser is null: "+addr);+ Ftp.LOG.warn("ftp.parser is null: "+addr);ftp.client.logout();ftp.client.disconnect();this.code = 500; // http Internal Server Error@@ -254,10 +254,10 @@ public class FtpResponse {}} catch (Exception e) {- ftp.LOG.warning(""+e);+ ftp.LOG.warn(""+e);StackTraceElement stes[] = e.getStackTrace();for (int i=0; i<stes.length; i++) {- ftp.LOG.warning(" "+stes[i].toString());+ ftp.LOG.warn(" "+stes[i].toString());}// for any un-foreseen exception (run time exception or not),// do ultimate clean and leave ftp.client for garbage collection@@ -321,7 +321,7 @@ public class FtpResponse {// thrown by retrieveList() (not retrieveFile()) above,if (os == null) { // indicating throwing by retrieveList()//throw new FtpException("fail to get attibutes: "+path);- Ftp.LOG.warning(+ Ftp.LOG.warn("Please try larger maxContentLength for ftp.client.retrieveList(). "+ e);// in a way, this is our request fault@@ -360,7 +360,7 @@ public class FtpResponse {} catch (FtpExceptionUnknownForcedDataClose e) {// Please note control channel is still live.// in a way, this is our request fault- Ftp.LOG.warning(+ Ftp.LOG.warn("Unrecognized reply after forced close of data channel. "+ "If this is acceptable, please modify Client.java accordingly. "+ e);@@ -424,13 +424,13 @@ public class FtpResponse {} catch (FtpExceptionUnknownForcedDataClose e) {// Please note control channel is still live.// in a way, this is our request fault- Ftp.LOG.warning(+ Ftp.LOG.warn("Unrecognized reply after forced close of data channel. "+ "If this is acceptable, please modify Client.java accordingly. "+ e);this.code = 400; // http Bad Request} catch (FtpExceptionCanNotHaveDataConnection e) {- Ftp.LOG.warning(""+ e);+ Ftp.LOG.warn(""+ e);this.code = 500; // http Iternal Server Error}diff --git a/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/PrintCommandListener.java b/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/PrintCommandListener.javaindex 05c613916..c83a9f872 100644--- a/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/PrintCommandListener.java+++ b/src/plugin/protocol-ftp/src/java/org/apache/nutch/protocol/ftp/PrintCommandListener.java@@ -20,7 +20,8 @@ import java.io.BufferedReader;import java.io.StringReader;import java.io.IOException;-import java.util.logging.Logger;+import org.apache.commons.logging.Log;+import org.apache.commons.net.ProtocolCommandEvent;import org.apache.commons.net.ProtocolCommandListener;@@ -31,9 +32,9 @@ import org.apache.commons.net.ProtocolCommandListener;***/public class PrintCommandListener implements ProtocolCommandListener{- private Logger __logger;+ private Log __logger;- public PrintCommandListener(Logger logger)+ public PrintCommandListener(Log logger){__logger = logger;}diff --git a/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/Http.java b/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/Http.javaindex 73585095d..b1d7b6275 100755--- a/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/Http.java+++ b/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/Http.java@@ -18,23 +18,25 @@ package org.apache.nutch.protocol.http;// JDK importsimport java.io.IOException;import java.net.URL;-import java.util.logging.Level;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;++// Hadoop imports+import org.apache.hadoop.conf.Configuration;// Nutch importsimport org.apache.nutch.crawl.CrawlDatum;import org.apache.nutch.net.protocols.Response;import org.apache.nutch.protocol.ProtocolException;import org.apache.nutch.protocol.http.api.HttpBase;-import org.apache.hadoop.util.LogFormatter;-import org.apache.hadoop.conf.Configuration;import org.apache.nutch.util.NutchConfiguration;public class Http extends HttpBase {- public static final Logger LOG =- LogFormatter.getLogger(Http.class.getName());+ public static final Log LOG = LogFactory.getLog(Http.class);public Http() {@@ -43,11 +45,11 @@ public class Http extends HttpBase {public void setConf(Configuration conf) {super.setConf(conf);- Level logLevel = Level.WARNING;- if (conf.getBoolean("http.verbose", false)) {- logLevel = Level.FINE;- }- LOG.setLevel(logLevel);+// Level logLevel = Level.WARNING;+// if (conf.getBoolean("http.verbose", false)) {+// logLevel = Level.FINE;+// }+// LOG.setLevel(logLevel);}public static void main(String[] args) throws Exception {diff --git a/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java b/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.javaindex 9867ec96d..9b42a06a4 100644--- a/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java+++ b/src/plugin/protocol-http/src/java/org/apache/nutch/protocol/http/HttpResponse.java@@ -26,7 +26,6 @@ import java.io.PushbackInputStream;import java.net.InetSocketAddress;import java.net.Socket;import java.net.URL;-import java.util.logging.Level;// Nutch importsimport org.apache.nutch.crawl.CrawlDatum;@@ -35,6 +34,7 @@ import org.apache.nutch.net.protocols.Response;import org.apache.nutch.protocol.ProtocolException;import org.apache.nutch.protocol.http.api.HttpBase;import org.apache.nutch.protocol.http.api.HttpException;+import org.apache.nutch.util.LogUtil;/** An HTTP response. */@@ -60,8 +60,9 @@ public class HttpResponse implements Response {if (!"http".equals(url.getProtocol()))throw new HttpException("Not an HTTP url:" + url);- if (Http.LOG.isLoggable(Level.FINE))- Http.LOG.fine("fetching " + url);+ if (Http.LOG.isTraceEnabled()) {+ Http.LOG.trace("fetching " + url);+ }String path = "".equals(url.getFile()) ? "/" : url.getFile();@@ -113,7 +114,7 @@ public class HttpResponse implements Response {String userAgent = http.getUserAgent();if ((userAgent == null) || (userAgent.length() == 0)) {- Http.LOG.severe("User-agent is not set!");+ Http.LOG.fatal("User-agent is not set!");} else {reqStr.append("User-Agent: ");reqStr.append(userAgent);@@ -148,8 +149,9 @@ public class HttpResponse implements Response {if ("gzip".equals(contentEncoding) || "x-gzip".equals(contentEncoding)) {content = http.processGzipEncoded(content, url);} else {- if (Http.LOG.isLoggable(Level.FINE))- Http.LOG.fine("fetched " + content.length + " bytes from " + url);+ if (Http.LOG.isTraceEnabled()) {+ Http.LOG.trace("fetched " + content.length + " bytes from " + url);+ }}} finally {@@ -228,19 +230,19 @@ public class HttpResponse implements Response {ByteArrayOutputStream out = new ByteArrayOutputStream(Http.BUFFER_SIZE);while (!doneChunks) {- Http.LOG.fine("Http: starting chunk");+ Http.LOG.trace("Http: starting chunk");readLine(in, line, false);String chunkLenStr;- // LOG.fine("chunk-header: '" + line + "'");+ // LOG.trace("chunk-header: '" + line + "'");int pos= line.indexOf(";");if (pos < 0) {chunkLenStr= line.toString();} else {chunkLenStr= line.substring(0, pos);- // LOG.fine("got chunk-ext: " + line.substring(pos+1));+ // LOG.trace("got chunk-ext: " + line.substring(pos+1));}chunkLenStr= chunkLenStr.trim();int chunkLen;@@ -274,7 +276,7 @@ public class HttpResponse implements Response {// DANGER!!! Will printed GZIPed stuff right to your// terminal!- // LOG.fine("read: " + new String(bytes, 0, len));+ // LOG.trace("read: " + new String(bytes, 0, len));out.write(bytes, 0, len);chunkBytesRead+= len;@@ -370,7 +372,7 @@ public class HttpResponse implements Response {processHeaderLine(line);} catch (Exception e) {// fixme:- e.printStackTrace();+ e.printStackTrace(LogUtil.getErrorStream(Http.LOG));}return;}diff --git a/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/Http.java b/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/Http.javaindex bf9a24372..15b02f855 100644--- a/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/Http.java+++ b/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/Http.java@@ -19,8 +19,10 @@ package org.apache.nutch.protocol.httpclient;import java.io.IOException;import java.net.URL;import java.util.ArrayList;-import java.util.logging.Level;-import java.util.logging.Logger;++// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;// HTTP Client importsimport org.apache.commons.httpclient.Credentials;@@ -38,14 +40,13 @@ import org.apache.nutch.crawl.CrawlDatum;import org.apache.nutch.net.protocols.Response;import org.apache.nutch.protocol.ProtocolException;import org.apache.nutch.protocol.http.api.HttpBase;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;import org.apache.nutch.util.NutchConfiguration;public class Http extends HttpBase {- public static final Logger LOG = LogFormatter.getLogger("org.apache.nutch.net.Http");+ public static final Log LOG = LogFactory.getLog(Http.class);private static MultiThreadedHttpConnectionManager connectionManager =new MultiThreadedHttpConnectionManager();@@ -76,13 +77,13 @@ public class Http extends HttpBase {this.ntlmPassword = conf.get("http.auth.ntlm.password", "");this.ntlmDomain = conf.get("http.auth.ntlm.domain", "");this.ntlmHost = conf.get("http.auth.ntlm.host", "");- Level logLevel = Level.WARNING;- if (conf.getBoolean("http.verbose", false)) {- logLevel = Level.FINE;- }- LOG.setLevel(logLevel);- Logger.getLogger("org.apache.commons.httpclient.HttpMethodDirector")- .setLevel(logLevel);+ //Level logLevel = Level.WARNING;+ //if (conf.getBoolean("http.verbose", false)) {+ // logLevel = Level.FINE;+ //}+ //LOG.setLevel(logLevel);+ //Logger.getLogger("org.apache.commons.httpclient.HttpMethodDirector")+ // .setLevel(logLevel);configureClient();}diff --git a/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationFactory.java b/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationFactory.javaindex 7bb50f3f4..710191adf 100644--- a/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationFactory.java+++ b/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpAuthenticationFactory.java@@ -3,20 +3,25 @@package org.apache.nutch.protocol.httpclient;+// JDK importsimport java.util.ArrayList;import java.util.Collection;import java.util.Iterator;import java.util.Map;import java.util.TreeMap;-import java.util.logging.Level;-import java.util.logging.Logger;-import org.apache.nutch.metadata.Metadata;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;-import org.apache.hadoop.util.LogFormatter;+// Hadoop importsimport org.apache.hadoop.conf.Configuration;import org.apache.hadoop.conf.Configurable;+// Nutch imports+import org.apache.nutch.metadata.Metadata;+import org.apache.nutch.util.LogUtil;+/*** Provides the Http protocol implementation@@ -38,8 +43,7 @@ public class HttpAuthenticationFactory implements Configurable {*/public static final String WWW_AUTHENTICATE = "WWW-Authenticate";- public static final Logger LOG =- LogFormatter.getLogger(HttpAuthenticationFactory.class.getName());+ public static final Log LOG = LogFactory.getLog(HttpAuthenticationFactory.class);private static Map auths = new TreeMap();@@ -57,11 +61,11 @@ public class HttpAuthenticationFactory implements Configurable {public void setConf(Configuration conf) {this.conf = conf;- if (conf.getBoolean("http.auth.verbose", false)) {- LOG.setLevel(Level.FINE);- } else {- LOG.setLevel(Level.WARNING);- }+ //if (conf.getBoolean("http.auth.verbose", false)) {+ // LOG.setLevel(Level.FINE);+ //} else {+ // LOG.setLevel(Level.WARNING);+ //}}public Configuration getConf() {@@ -95,7 +99,7 @@ public class HttpAuthenticationFactory implements Configurable {}}if (challenge == null) {- LOG.fine("Authentication challenge is null");+ LOG.trace("Authentication challenge is null");return null;}@@ -107,14 +111,14 @@ public class HttpAuthenticationFactory implements Configurable {challengeString="Basic realm=techweb";}- LOG.fine("Checking challengeString=" + challengeString);+ LOG.trace("Checking challengeString=" + challengeString);auth = HttpBasicAuthentication.getAuthentication(challengeString, conf);if (auth != null) return auth;//TODO Add additional Authentication lookups here}} catch (Exception e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getErrorStream(LOG));}return null;}diff --git a/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpBasicAuthentication.java b/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpBasicAuthentication.javaindex ca29b7f8c..4d62ab2c4 100644--- a/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpBasicAuthentication.java+++ b/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpBasicAuthentication.java@@ -3,21 +3,26 @@package org.apache.nutch.protocol.httpclient;+// JDK importsimport java.util.ArrayList;import java.util.List;import java.util.Map;import java.util.TreeMap;-import java.util.logging.Level;-import java.util.logging.Logger;import java.util.regex.Matcher;import java.util.regex.Pattern;+// Commons Codec importsimport org.apache.commons.codec.binary.Base64;-import org.apache.hadoop.util.LogFormatter;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;++// Hadoop importsimport org.apache.hadoop.conf.Configuration;import org.apache.hadoop.conf.Configurable;+/*** Implementation of RFC 2617 Basic Authentication. Usernames and passwords are stored* in standard Nutch configuration files using the following properties:@@ -28,8 +33,7 @@ import org.apache.hadoop.conf.Configurable;*/public class HttpBasicAuthentication implements HttpAuthentication, Configurable {- public static final Logger LOG =- LogFormatter.getLogger(HttpBasicAuthentication.class.getName());+ public static final Log LOG = LogFactory.getLog(HttpBasicAuthentication.class);private static Pattern basic = Pattern.compile("[bB][aA][sS][iI][cC] [rR][eE][aA][lL][mM]=\"(\\w*)\"");@@ -53,13 +57,13 @@ public class HttpBasicAuthentication implements HttpAuthentication, ConfigurablesetConf(conf);this.challenge = challenge;- LOG.fine("BasicAuthentication challenge is " + challenge);+ LOG.trace("BasicAuthentication challenge is " + challenge);credentials = new ArrayList();String username = this.conf.get("http.auth.basic." + challenge + ".user");- LOG.fine("BasicAuthentication username=" + username);+ LOG.trace("BasicAuthentication username=" + username);String password = this.conf.get("http.auth.basic." + challenge + ".password");- LOG.fine("BasicAuthentication password=" + password);+ LOG.trace("BasicAuthentication password=" + password);if (username == null) {throw new HttpAuthenticationException("Username for " + challenge + " is null");@@ -71,7 +75,7 @@ public class HttpBasicAuthentication implements HttpAuthentication, Configurablebyte[] credBytes = (username + ":" + password).getBytes();credentials.add("Authorization: Basic " + new String(Base64.encodeBase64(credBytes)));- LOG.fine("Basic credentials: " + credentials);+ LOG.trace("Basic credentials: " + credentials);}@@ -81,11 +85,11 @@ public class HttpBasicAuthentication implements HttpAuthentication, Configurablepublic void setConf(Configuration conf) {this.conf = conf;- if (conf.getBoolean("http.auth.verbose", false)) {- LOG.setLevel(Level.FINE);- } else {- LOG.setLevel(Level.WARNING);- }+ //if (conf.getBoolean("http.auth.verbose", false)) {+ // LOG.setLevel(Level.FINE);+ //} else {+ // LOG.setLevel(Level.WARNING);+ //}}public Configuration getConf() {@@ -141,7 +145,7 @@ public class HttpBasicAuthentication implements HttpAuthentication, Configurabletry {newAuth = new HttpBasicAuthentication(realm, conf);} catch (HttpAuthenticationException hae) {- LOG.fine("HttpBasicAuthentication failed for " + challenge);+ LOG.trace("HttpBasicAuthentication failed for " + challenge);}authMap.put(realm, newAuth);return newAuth;diff --git a/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpResponse.java b/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpResponse.javaindex f3a253013..348fae1fe 100644--- a/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpResponse.java+++ b/src/plugin/protocol-httpclient/src/java/org/apache/nutch/protocol/httpclient/HttpResponse.java@@ -22,6 +22,10 @@ import java.io.InputStream;import java.net.URL;import java.util.Date;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+// HTTP Client importsimport org.apache.commons.httpclient.Header;import org.apache.commons.httpclient.HttpVersion;@@ -34,6 +38,7 @@ import org.apache.nutch.crawl.CrawlDatum;import org.apache.nutch.metadata.Metadata;import org.apache.nutch.net.protocols.Response;import org.apache.nutch.protocol.http.api.HttpBase;+import org.apache.nutch.util.LogUtil;/**@@ -41,6 +46,8 @@ import org.apache.nutch.protocol.http.api.HttpBase;*/public class HttpResponse implements Response {+ public final static Log LOG = LogFactory.getLog(HttpResponse.class);+private URL url;private String orig;@@ -121,7 +128,7 @@ public class HttpResponse implements Response {}}} catch (org.apache.commons.httpclient.ProtocolException pe) {- pe.printStackTrace();+ pe.printStackTrace(LogUtil.getErrorStream(LOG));get.releaseConnection();throw new IOException(pe.toString());} finally {diff --git a/src/plugin/query-more/src/java/org/apache/nutch/searcher/more/DateQueryFilter.java b/src/plugin/query-more/src/java/org/apache/nutch/searcher/more/DateQueryFilter.javaindex 3c63d5c5a..ef17fcaee 100644--- a/src/plugin/query-more/src/java/org/apache/nutch/searcher/more/DateQueryFilter.java+++ b/src/plugin/query-more/src/java/org/apache/nutch/searcher/more/DateQueryFilter.java@@ -21,9 +21,11 @@ import org.apache.nutch.searcher.Query.Clause;import org.apache.nutch.searcher.QueryFilter;import org.apache.nutch.searcher.QueryException;-import org.apache.hadoop.util.LogFormatter;import org.apache.hadoop.conf.Configuration;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.lucene.search.BooleanClause;import org.apache.lucene.search.BooleanQuery;import org.apache.lucene.search.RangeQuery;@@ -32,7 +34,6 @@ import org.apache.lucene.index.Term;import java.util.regex.Pattern;import java.util.regex.Matcher;-import java.util.logging.Logger;/*** Handles "date:" query clauses, causing them to search the field "date"@@ -42,8 +43,7 @@ import java.util.logging.Logger;*/public class DateQueryFilter implements QueryFilter {- public static final Logger LOG- = LogFormatter.getLogger(DateQueryFilter.class.getName());+ public static final Log LOG = LogFactory.getLog(DateQueryFilter.class);private static final String FIELD_NAME = "date";diff --git a/src/plugin/scoring-opic/src/java/org/apache/nutch/scoring/opic/OPICScoringFilter.java b/src/plugin/scoring-opic/src/java/org/apache/nutch/scoring/opic/OPICScoringFilter.javaindex 7faa3de40..72ed75a6c 100644--- a/src/plugin/scoring-opic/src/java/org/apache/nutch/scoring/opic/OPICScoringFilter.java+++ b/src/plugin/scoring-opic/src/java/org/apache/nutch/scoring/opic/OPICScoringFilter.java@@ -18,6 +18,10 @@ package org.apache.nutch.scoring.opic;import java.util.List;+// Commons Logging imports+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.io.UTF8;import org.apache.lucene.document.Document;@@ -30,6 +34,7 @@ import org.apache.nutch.parse.ParseData;import org.apache.nutch.protocol.Content;import org.apache.nutch.scoring.ScoringFilter;import org.apache.nutch.scoring.ScoringFilterException;+import org.apache.nutch.util.LogUtil;/*** This plugin implements a variant of an Online Page Importance Computation@@ -42,6 +47,9 @@ import org.apache.nutch.scoring.ScoringFilterException;* @author Andrzej Bialecki*/public class OPICScoringFilter implements ScoringFilter {++ private final static Log LOG = LogFactory.getLog(OPICScoringFilter.class);+private Configuration conf;private float scoreInjected;private float scorePower;@@ -96,7 +104,7 @@ public class OPICScoringFilter implements ScoringFilter {try {score = Float.parseFloat(scoreString);} catch (Exception e) {- e.printStackTrace();+ e.printStackTrace(LogUtil.getWarnStream(LOG));}}if (countFiltered) {diff --git a/src/plugin/subcollection/src/java/org/apache/nutch/collection/CollectionManager.java b/src/plugin/subcollection/src/java/org/apache/nutch/collection/CollectionManager.javaindex d08f2d268..553aff007 100644--- a/src/plugin/subcollection/src/java/org/apache/nutch/collection/CollectionManager.java+++ b/src/plugin/subcollection/src/java/org/apache/nutch/collection/CollectionManager.java@@ -25,11 +25,14 @@ import java.util.Collection;import java.util.HashMap;import java.util.Iterator;import java.util.Map;-import java.util.logging.Logger;++import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.conf.Configured;import org.apache.nutch.util.DomUtil;+import org.apache.nutch.util.LogUtil;import org.apache.nutch.util.NutchConfiguration;import org.apache.xerces.dom.DocumentImpl;import org.w3c.dom.Document;@@ -40,8 +43,7 @@ public class CollectionManager extends Configured {public static final String DEFAULT_FILE_NAME = "subcollections.xml";- static final Logger LOG = org.apache.hadoop.util.LogFormatter.getLogger(CollectionManager.class- .getName());+ static final Log LOG = LogFactory.getLog(CollectionManager.class);transient Map collectionMap = new HashMap();@@ -70,8 +72,8 @@ public class CollectionManager extends Configured {getConf().get("subcollections.config", DEFAULT_FILE_NAME));parse(input);} catch (Exception e) {- LOG.info("Error occured:" + e);- e.printStackTrace(System.out);+ LOG.warn("Error occured:" + e);+ e.printStackTrace(LogUtil.getWarnStream(LOG));}}@@ -168,7 +170,7 @@ public class CollectionManager extends Configured {collections += " " + subCol.name;}}- LOG.fine("subcollections:" + collections);+ LOG.trace("subcollections:" + collections);return collections;}diff --git a/src/plugin/subcollection/src/java/org/apache/nutch/indexer/subcollection/SubcollectionIndexingFilter.java b/src/plugin/subcollection/src/java/org/apache/nutch/indexer/subcollection/SubcollectionIndexingFilter.javaindex 49023cb34..c72ba863c 100644--- a/src/plugin/subcollection/src/java/org/apache/nutch/indexer/subcollection/SubcollectionIndexingFilter.java+++ b/src/plugin/subcollection/src/java/org/apache/nutch/indexer/subcollection/SubcollectionIndexingFilter.java@@ -18,10 +18,12 @@ package org.apache.nutch.indexer.subcollection;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.conf.Configured;import org.apache.hadoop.io.UTF8;-import org.apache.hadoop.util.LogFormatter;import org.apache.lucene.document.Document;import org.apache.lucene.document.Field;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.nutch.parse.Parse;import org.apache.nutch.util.NutchConfiguration;@@ -32,7 +34,6 @@ import org.apache.nutch.collection.CollectionManager;import org.apache.nutch.crawl.CrawlDatum;import org.apache.nutch.crawl.Inlinks;-import java.util.logging.Logger;public class SubcollectionIndexingFilter extends Configured implements IndexingFilter {@@ -52,8 +53,7 @@ public class SubcollectionIndexingFilter extends Configured implements IndexingF/*** Logger*/- public static final Logger LOG = LogFormatter- .getLogger(SubcollectionIndexingFilter.class.getName());+ public static final Log LOG = LogFactory.getLog(SubcollectionIndexingFilter.class);/*** "Mark" document to be a part of subcollectiondiff --git a/src/plugin/urlfilter-prefix/src/java/org/apache/nutch/urlfilter/prefix/PrefixURLFilter.java b/src/plugin/urlfilter-prefix/src/java/org/apache/nutch/urlfilter/prefix/PrefixURLFilter.javaindex 4759431a8..527066056 100644--- a/src/plugin/urlfilter-prefix/src/java/org/apache/nutch/urlfilter/prefix/PrefixURLFilter.java+++ b/src/plugin/urlfilter-prefix/src/java/org/apache/nutch/urlfilter/prefix/PrefixURLFilter.java@@ -18,8 +18,10 @@package org.apache.nutch.urlfilter.prefix;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import org.apache.hadoop.conf.Configuration;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.net.*;import org.apache.nutch.util.PrefixStringMatcher;@@ -36,7 +38,6 @@ import java.io.IOException;import java.util.List;import java.util.ArrayList;-import java.util.logging.Logger;/*** Filters URLs based on a file of URL prefixes. The file is named by@@ -48,8 +49,7 @@ import java.util.logging.Logger;*/public class PrefixURLFilter implements URLFilter {- private static final Logger LOG =- LogFormatter.getLogger(PrefixURLFilter.class.getName());+ private static final Log LOG = LogFactory.getLog(PrefixURLFilter.class);// read in attribute "file" of this plugin.private static String attributeFile = null;@@ -134,7 +134,7 @@ public class PrefixURLFilter implements URLFilter {LOG.info("Attribute \"file\" is defined for plugin " + pluginName+ " as " + attributeFile);} else {- // LOG.warning("Attribute \"file\" is not defined in plugin.xml for+ // LOG.warn("Attribute \"file\" is not defined in plugin.xml for// plugin "+pluginName);}@@ -150,7 +150,7 @@ public class PrefixURLFilter implements URLFilter {try {trie = readConfigurationFile(reader);} catch (IOException e) {- LOG.severe(e.getMessage());+ LOG.fatal(e.getMessage());// TODO [email protected]: throw Exception? Because broken api.throw new RuntimeException(e.getMessage(), e);}diff --git a/src/plugin/urlfilter-suffix/src/java/org/apache/nutch/urlfilter/suffix/SuffixURLFilter.java b/src/plugin/urlfilter-suffix/src/java/org/apache/nutch/urlfilter/suffix/SuffixURLFilter.javaindex b199d5bb1..e84fa8c38 100644--- a/src/plugin/urlfilter-suffix/src/java/org/apache/nutch/urlfilter/suffix/SuffixURLFilter.java+++ b/src/plugin/urlfilter-suffix/src/java/org/apache/nutch/urlfilter/suffix/SuffixURLFilter.java@@ -17,7 +17,6 @@package org.apache.nutch.urlfilter.suffix;import org.apache.hadoop.conf.Configuration;-import org.apache.hadoop.util.LogFormatter;import org.apache.nutch.net.*;import org.apache.nutch.util.NutchConfiguration;@@ -27,6 +26,9 @@ import org.apache.nutch.util.TrieStringMatcher;import org.apache.nutch.plugin.Extension;import org.apache.nutch.plugin.PluginRepository;+import org.apache.commons.logging.Log;+import org.apache.commons.logging.LogFactory;+import java.io.Reader;import java.io.FileReader;import java.io.BufferedReader;@@ -35,7 +37,6 @@ import java.io.IOException;import java.util.List;import java.util.ArrayList;-import java.util.logging.Logger;/*** Filters URLs based on a file of URL suffixes. The file is named by@@ -118,7 +119,7 @@ import java.util.logging.Logger;*/public class SuffixURLFilter implements URLFilter {- private static final Logger LOG = LogFormatter.getLogger(SuffixURLFilter.class.getName());+ private static final Log LOG = LogFactory.getLog(SuffixURLFilter.class);// read in attribute "file" of this plugin.private String attributeFile = null;@@ -158,7 +159,7 @@ public class SuffixURLFilter implements URLFilter {// handle missing config fileif (reader == null) {- LOG.warning("Missing urlfilter.suffix.file, all URLs will be rejected!");+ LOG.warn("Missing urlfilter.suffix.file, all URLs will be rejected!");suffixes = new SuffixStringMatcher(new String[0]);modeAccept = false;ignoreCase = false;@@ -241,7 +242,7 @@ public class SuffixURLFilter implements URLFilter {if (attributeFile != null) {LOG.info("Attribute \"file\" is defined for plugin " + pluginName + " as " + attributeFile);} else {- // LOG.warning("Attribute \"file\" is not defined in plugin.xml for+ // LOG.warn("Attribute \"file\" is not defined in plugin.xml for// plugin "+pluginName);}@@ -253,7 +254,7 @@ public class SuffixURLFilter implements URLFilter {try {readConfigurationFile(reader);} catch (IOException e) {- LOG.severe(e.getMessage());+ LOG.fatal(e.getMessage());throw new RuntimeException(e.getMessage(), e);}}@@ -277,4 +278,4 @@ public class SuffixURLFilter implements URLFilter {public void setIgnoreCase(boolean ignoreCase) {this.ignoreCase = ignoreCase;}-}\ No newline at end of file+}diff --git a/src/test/log4j.properties b/src/test/log4j.propertiesnew file mode 100644index 000000000..1a2122a95--- /dev/null+++ b/src/test/log4j.properties@@ -0,0 +1,7 @@+# log4j configuration used during build and unit tests++log4j.rootLogger=info,stdout+log4j.threshhold=ALL+log4j.appender.stdout=org.apache.log4j.ConsoleAppender+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} (%F:%M(%L)) - %m%ndiff --git a/src/web/log4j.properties b/src/web/log4j.propertiesnew file mode 100644index 000000000..aa479106c--- /dev/null+++ b/src/web/log4j.properties@@ -0,0 +1,7 @@+# log4j configuration used by the front-end container++log4j.rootLogger=info,stdout+log4j.threshhold=ALL+log4j.appender.stdout=org.apache.log4j.ConsoleAppender+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{1} - %m%n