如何删除 Java 控制台的 MongoDB 消息?
How can I remove the MongoDB message of Java console?
我有 MongoDB 3.2.9
,我正在用 Jongo 1.3.0
开发一个 Java 应用程序,但是 NetBeans
控制台显示下一个 red 留言:
nov 24, 2016 2:30:17 AM com.mongodb.diagnostics.logging.JULLogger log
INFORMACIÓN: Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
nov 24, 2016 2:30:18 AM com.mongodb.diagnostics.logging.JULLogger log
INFORMACIÓN: Opened connection [connectionId{localValue:1, serverValue:86}] to localhost:27017
nov 24, 2016 2:30:18 AM com.mongodb.diagnostics.logging.JULLogger log
INFORMACIÓN: Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 2, 9]}, minWireVersion=0, maxWireVersion=4, maxDocumentSize=16777216, roundTripTimeNanos=4886848}
nov 24, 2016 2:30:19 AM com.mongodb.diagnostics.logging.JULLogger log
INFORMACIÓN: Opened connection [connectionId{localValue:2, serverValue:87}] to localhost:27017
因为这个项目是大学作业,我的老师会说我这是一个问题;因此,我想删除这些消息或更改其颜色。
作为附加信息,我正在使用:
- bson4jackson-2.7.0.jar
- jackson-annotations-2.7.3.jar
- jackson-core-2.7.3.jar
- jackson-databind-2.7.3.jar
- mongo-java-driver-3.2.2.jar
...当我更改 mongo-java-driver
版本时,我的应用程序无法运行。
这是我的 java 代码:
collection = (new Jongo(new MongoClient( "localhost" , 27017 ).getDB("mydb"))).getCollection("mycollection");
谢谢大家。
这是我的解决方案:
Logger mongoLogger = Logger.getLogger( "org.mongodb.driver" );
mongoLogger.setLevel(Level.SEVERE);
我有 MongoDB 3.2.9
,我正在用 Jongo 1.3.0
开发一个 Java 应用程序,但是 NetBeans
控制台显示下一个 red 留言:
nov 24, 2016 2:30:17 AM com.mongodb.diagnostics.logging.JULLogger log
INFORMACIÓN: Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
nov 24, 2016 2:30:18 AM com.mongodb.diagnostics.logging.JULLogger log
INFORMACIÓN: Opened connection [connectionId{localValue:1, serverValue:86}] to localhost:27017
nov 24, 2016 2:30:18 AM com.mongodb.diagnostics.logging.JULLogger log
INFORMACIÓN: Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 2, 9]}, minWireVersion=0, maxWireVersion=4, maxDocumentSize=16777216, roundTripTimeNanos=4886848}
nov 24, 2016 2:30:19 AM com.mongodb.diagnostics.logging.JULLogger log
INFORMACIÓN: Opened connection [connectionId{localValue:2, serverValue:87}] to localhost:27017
因为这个项目是大学作业,我的老师会说我这是一个问题;因此,我想删除这些消息或更改其颜色。
作为附加信息,我正在使用:
- bson4jackson-2.7.0.jar
- jackson-annotations-2.7.3.jar
- jackson-core-2.7.3.jar
- jackson-databind-2.7.3.jar
- mongo-java-driver-3.2.2.jar
...当我更改 mongo-java-driver
版本时,我的应用程序无法运行。
这是我的 java 代码:
collection = (new Jongo(new MongoClient( "localhost" , 27017 ).getDB("mydb"))).getCollection("mycollection");
谢谢大家。 这是我的解决方案:
Logger mongoLogger = Logger.getLogger( "org.mongodb.driver" );
mongoLogger.setLevel(Level.SEVERE);