How to Disable Mongodb Log Messages in Console

How can I disable MongoDB log messages in console?

This logging is coming from the Ruby Mongo driver. The default logging level seems to be Logger::DEBUG. Change it to something higher to disable the debug output:

Mongo::Logger.logger.level = Logger::FATAL

To make the driver log to a logfile instead:

Mongo::Logger.logger       = Logger.new('mongo.log')
Mongo::Logger.logger.level = Logger::INFO

Note that if you're using the Mongoid ODM, then you may want to adjust logging there too:

Mongoid.logger       = Logger.new('mongoid.log')
Mongoid.logger.level = Logger::INFO

For Rails + Mongoid in application.rb:

config.mongoid.logger = Logger.new(Rails.root + '/log/mongoid.log', :warn)

# ...or change the logging level without a new file destination
config.mongoid.logger.level = Logger::INFO

Disable Console Logging from MongoDB in Eclipse

Thank you very much Ross for your suggestion:

java.util.logging.Logger.getLogger("org.mongodb.driver").setLevel(java.util.log‌​ging.Level.SEVERE);

In fact the correct code was this, so only a minor change:

java.util.logging.Logger.getLogger("org.mongodb.driver").setLevel(Level.SEVERE);

I can confirm that I am not longer receiving any logs from mongo within the console at runtime.

How can I remove the MongoDB message of Java console?

Thank you for all.
This was my solution:

Logger mongoLogger = Logger.getLogger( "org.mongodb.driver" );
mongoLogger.setLevel(Level.SEVERE);

How to disable mongoDB java driver logging?

So this solved this issue:

import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;

...

static Logger root = (Logger) LoggerFactory
.getLogger(Logger.ROOT_LOGGER_NAME);

static {
root.setLevel(Level.INFO);
}

You may set the Level to a higher Level if you wish to hide all the logs.

how to prevent logging on console when connected to mongodb from java?

Thanks to @jyemin
By using MongoDB official documentation link

Logger mongoLogger = Logger.getLogger( "org.mongodb.driver" );
mongoLogger.setLevel(Level.SEVERE);

Now no logs are there in the console.

How to disable node mongodb-native driver connections logging in console

This message is not coming from node.js or the node-mongodb-native driver. It is coming from the mongo daemon.

When Starting mongo simply pass the --quiet option and this message will disapear.



Related Topics



Leave a reply



Submit