You need to set a couple of system properties before loading any of the MongoDB Java driver classes:
// Enable MongoDB logging in general
System.setProperty("DEBUG.MONGO", "true");
// Enable DB operation tracing
System.setProperty("DB.TRACE", "true");
After doing that the driver will use the standard Java logging framework to log messages.
Unfortunately, as far as I can tell from the Java driver code, the logging granularity is not all that fine - for example you cannot selectively log operations on a specific collection.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…