Hi list,<br><br>I'm working on the task of upgrading our Apache Nutch codebase to use SLF4J with Log4J backend, therefore using the migrator. Testing in a development environment all JUnit tests, build and compile ant tasks pass successfully, however when moving into production (when exceptions are caught) we are having some problems. The full JIRA issue can be seen here[1].<br>
<br>Namely the following class [2] at around this code snippet<br>{code}<br><pre> } catch (Throwable e) {
e.printStackTrace(LogUtil.getErrorStream(logger));
return new ProtocolOutput(null, new ProtocolStatus(e));
}
}
/* -------------------------- *
* </implementation:Protocol> *
* -------------------------- */</pre>{code}<br><br>To be honest, I'm pretty stumped as I've read all of the migrator documentation and not surprisingly as far as I know, none seems to be specific enough to address this issue. Does anyone have any suggestions as to how this code can be manually edited to prevent the various errors occuring as shown below.<br>
<br><pre class="code-java">2011-09-22 19:36:02,046 ERROR org.apache.nutch.util.LogUtil: Cannot log with method [<span class="code-keyword">null</span>]
java.lang.NullPointerException
at org.apache.nutch.util.LogUtil$1.flush(LogUtil.java:103)
at java.io.PrintStream.write(PrintStream.java:432)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272)
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:85)
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:168)
at java.io.PrintStream.newLine(PrintStream.java:496)
at java.io.PrintStream.println(PrintStream.java:774)
at java.lang.Throwable.printStackTrace(Throwable.java:461)
at org.apache.nutch.protocol.http.api.HttpBase.getProtocolOutput(HttpBase.java:197) <<<<<<< HERE
at org.apache.nutch.fetcher.Fetcher$FetcherThread.run(Fetcher.java:665)<br><br>2011-09-22 19:44:26,929 ERROR org.apache.nutch.util.LogUtil: Cannot init log methods
java.lang.NoSuchMethodException: org.slf4j.Logger.trace(java.lang.<span class="code-object">Object</span>)
at java.lang.<span class="code-object">Class</span>.getMethod(<span class="code-object">Class</span>.java:1605)
at org.apache.nutch.util.LogUtil.<clinit>(LogUtil.java:48)
at org.apache.nutch.protocol.http.api.HttpBase.getProtocolOutput(HttpBase.java:197) <<<<<<< HERE
at org.apache.nutch.fetcher.Fetcher$FetcherThread.run(Fetcher.java:665)<br></pre><br clear="all">Thank you kindly in advance for any suggestions.<br><br>Lewis<br><br>[1] <a href="https://issues.apache.org/jira/browse/NUTCH-1078">https://issues.apache.org/jira/browse/NUTCH-1078</a><br>
[2] <a href="https://svn.apache.org/repos/asf/nutch/branches/branch-1.4/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java">https://svn.apache.org/repos/asf/nutch/branches/branch-1.4/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java</a><br>
[3] <a href="http://www.slf4j.org/migrator.html">http://www.slf4j.org/migrator.html</a><br>-- <br><font style="font-family:courier new,monospace;background-color:rgb(255, 255, 255);color:rgb(51, 102, 255)" size="4"><i>Lewis</i></font><span style="background-color:rgb(255, 255, 255);color:rgb(51, 102, 255)"></span> <br>
<br>