summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/keuin/blame/util/DatabaseUtil.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/java/com/keuin/blame/util/DatabaseUtil.java b/src/main/java/com/keuin/blame/util/DatabaseUtil.java
index dc5cca2..d68bc4d 100644
--- a/src/main/java/com/keuin/blame/util/DatabaseUtil.java
+++ b/src/main/java/com/keuin/blame/util/DatabaseUtil.java
@@ -1,7 +1,8 @@
package com.keuin.blame.util;
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.LoggerContext;
+//import ch.qos.logback.classic.Level;
+//import ch.qos.logback.classic.LoggerContext;
+
import com.keuin.blame.Blame;
import com.keuin.blame.config.MongoConfig;
import com.keuin.blame.data.enums.codec.ActionTypeCodec;
@@ -12,7 +13,9 @@ import com.mongodb.MongoClientSettings;
import org.bson.codecs.configuration.CodecRegistries;
import org.bson.codecs.configuration.CodecRegistry;
import org.bson.codecs.pojo.PojoCodecProvider;
-import org.slf4j.LoggerFactory;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
import static org.bson.codecs.configuration.CodecRegistries.fromProviders;
@@ -39,6 +42,11 @@ public class DatabaseUtil {
// db.log.createIndex({ timestamp_millis: -1, subject_id: "hashed" })
public static void disableMongoSpamming() {
- ((LoggerContext) LoggerFactory.getILoggerFactory()).getLogger("org.mongodb.driver").setLevel(Level.ERROR);
+// ((LoggerContext) LoggerFactory.getILoggerFactory()).getLogger("org.mongodb.driver").setLevel(Level.ERROR);
+ String[] mongoDrivers = new String[] {"org.mongodb", "org.mongodb.driver", "org.mongodb.driver.cluster", "org.mongodb.driver.connection"};
+ for (String driverName : mongoDrivers) {
+ Logger mongoLogger = Logger.getLogger(driverName);
+ mongoLogger.setLevel(Level.OFF); // Plz be silent, my boy.
+ }
}
}