So mongoDB is running on 27017 and my collection name is test.
try {
// - Connection to base
String mongoURI = \"mongodb://localhost:27
I agree with @AdamC: you need log4j. But I would say that it's not a matter of "installing" it; you just need to add a log4j.jar file to your project classpath. Your code looks fine.
EDIT: moving info from my comment into the answer.
In addition to adding log4j.jar to the classpath, you also need a file called log4j.properties to configure log4j. You can create your own, or you can grab the copy from the MongoDB connector source on jasperforge. Look for src/main/resources/log4j.properties.