Mongo db set db.setLogLevel()


I am trying to log every queries and activity on MongoDB log files. can anyone helpo me on this.

How can i log everything into log files including queries and activity.

Can anyone explain about [ db.setLogLevel() 0 to 5 levels in depth

The first step is to read

If anything is unclear, further help can be provided here.


Thank you for reply. however i have ready docs already but not bale to understand.

can you help me with difference between 0 to 5 level of log level with example.

I would not know what to add to what is indicated in the documentation:

The verbosity level can range from 0 to 5 :

  • 0 is the MongoDB’s default log verbosity level, to include Informational messages.
  • 1 to 5 increases the verbosity level to include Debug messages.

Some of the link from the one I supplied sends you to which contains some examples.


I am not bale to understand the difference informational and debug messages.

sorry for this but it will be very helpful if you clear this thing for me as this is very important for me right now
Thank you in advance