我正在使用 Fongo,Fongo 是 MongoDB 的内存中 Java 实现。
如何防止这些日志它创建一个占用大量空间的冗长日志。我正在使用以下依赖项
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>com.github.fakemongo</groupId>
<artifactId>fongo</artifactId>
<version>2.1.1</version>
</dependency>
我得到这种日志
12:13:34.406 [TestNG-test=Package with subpackages-1] DEBUG com.mongodb.FongoDBCollection
12:13:34.406 [TestNG-test=Package with subpackages-1] DEBUG com.mongodb.FongoDBCollection
12:13:34.407 [TestNG-test=Package with subpackages-1] DEBUG com.mongodb.FongoDBCollection
12:13:34.407 [TestNG-test=Package with subpackages-1] DEBUG com.mongodb.FongoDBCollection
12:13:34.407 [TestNG-test=Package with subpackages-1] DEBUG com.github.fakemongo.impl.ExpressionParser
12:13:34.407 [TestNG-test=Package with subpackages-1] DEBUG com.mongodb.FongoDBCollection
获取以下代码的大量日志(在第 3 行)。
MongoCollection<Document> colls = db.getCollection("test_data");
Document criteriaDoc = (new Search(criteriaString)).getCriteria();
Document doc = colls.aggregate(Arrays.asList(Aggregates.match(criteriaDoc), Aggregates.sample(1))).first();