How to run mongodb instance in ERROR log level mode?

659 views Asked by At

Not able to run mongodb instance in ERROR log level. As defined by mongodb documentation, by default verbosity is 0 which includes information messages. But increasing verbosity to 1-5 will include debug level messages. I need only error messages to be logged in my log file. I am currently using mongodb-3.6.3 version with java driver at client side.

Is there any way to do it? If yes, how to achieve this? I've already tried reducing logs by adding quiet = true in the config file. But still, a lot of unnecessary logs are generated.

1

There are 1 answers

4
Mebin Joe On

Add this line to your application.properties file and check the console output after running any MongoRepository query.

logging.level.org.springframework.data.mongodb.core.MongoTemplate=ERROR