How to set logging level for information for MongoDb?

I have a Rails application that uses MongoDb on the back. I have these messages that say MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production MONGODB [WARNING] Please note that logging negatively impacts client-side performance. You should set your logging level no lower than :info in production in my logs. Well, I never worried about it, but decided to watch it now.

This page on the mongo website does not actually discuss logging levels, but discusses -v vs -vvvv for verbosity. Is it the same as the log level? How does -vvvvv match the debug log level, and -vvvvv -v match the error log level? The docs are very unclear in this thread.

+6
source share
3 answers

Logging levels refer to rails logging levels, while the -v flag refers to verbosity.

Rails automatically sets the logging level higher than during development, so you have nothing to worry about.

+1
source

I had problems with this in my tests, so I ended up doing the following in my spec_helper.rb:

 Mongoid.logger.level = Logger::INFO 

However, if you are inside the rails, you should probably (unchecked) use this to access the registrar:

 config.mongoid.logger 
+6
source

If you are using mongoid 2.2 or higher, you can set it to mongoid.yml:

 production: hosts: ... database: ... logger: false 

In addition, it affects performance. When I turned off mongo logging in production, I saw that there were fewer garbage collections and traces of application instance memory less than 15 megabytes in 30 minute load tests using apachebench.

+1
source

Source: https://habr.com/ru/post/905555/


All Articles