3

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 Answers1

-1

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
Mebin Joe
  • 2,172
  • 4
  • 16
  • 22
  • Thanks for response but I am not using spring framework at client side. Also, I need configuration for mongod server side. – Kunal Rockstar Apr 02 '19 at 11:24
  • @KunalRockstar I am speaking about server-side java(specifically spring boot). In the question you have added tag as java. – Mebin Joe Apr 02 '19 at 12:31
  • @KunalRockstar Maybe https://stackoverflow.com/questions/25907692/log-only-errors-in-mongodb-logs is what you are looking for. – Mebin Joe Apr 02 '19 at 12:35
  • 1
    No, I have already mentioned in the question that I tried adding quiet = true in the config file. But still a lot of unnecessary logs are generated. – Kunal Rockstar Apr 03 '19 at 12:03