Log4Mongo in Eclipse: can’t find getTimestamp()

Having added log4mongo to some of my older projects, I remove the old log4j-1.xxxx.jar and replace with log4j-1.2.15.jar. I start a junit test as usual and get an exception:
java.lang.NoSuchMethodError: org.apache.log4j.spi.LoggingEvent.getTimeStamp()J
at com.google.code.log4mongo.MongoDbAppender.bsonifyLoggingEvent(MongoDbAppender.java:216)
...

Go into the project properties in Eclipse (right-click on the project in the Package Explorer, hit properties), go to Order and Export tab and click on the log4j-1.2.15.jar. Press the Top button. Hit OK and re-run your test. Hey presto, sorted.

I haven’t done enough digging but I think it something to with the commons-logging having a out of date api and being first in the classpath it can findthe latest version of LoggingEvent.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s