[slf4j-user] Upgrading from commons logging using SLF4J Migrator

lewis john mcgibbney lewis.mcgibbney at gmail.com
Fri Sep 23 14:49:55 CEST 2011


Hi list,

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

Namely the following class [2] at around this code snippet
{code}

    } catch (Throwable e) {
      e.printStackTrace(LogUtil.getErrorStream(logger));
      return new ProtocolOutput(null, new ProtocolStatus(e));
    }
  }

  /* -------------------------- *
   * </implementation:Protocol> *
   * -------------------------- */

{code}

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.

2011-09-22 19:36:02,046 ERROR org.apache.nutch.util.LogUtil: Cannot
log with method [null]
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)

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.Object)
	at java.lang.Class.getMethod(Class.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)


Thank you kindly in advance for any suggestions.

Lewis

[1] https://issues.apache.org/jira/browse/NUTCH-1078
[2]
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
[3] http://www.slf4j.org/migrator.html
-- 
*Lewis*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-user/attachments/20110923/825b8945/attachment.html>


More information about the slf4j-user mailing list