0

This Questions could not help me: MongoDB logging all queries

Here is my configuration file:

dbpath  = C:\mongodb\data
logpath = C:\mongodb\mongo.log
diaglog = 3                      
profile = 2
slowms  = 1

but my log file contains no queries. What I'm doing wrong?

P.S: I'm using mongodb version v3.2.3

Community
  • 1
  • 1
alex
  • 8,904
  • 6
  • 49
  • 75

2 Answers2

1

You have two options to increase your log verbosity.

  1. Increase your log verbosity in configuration file. systemLog.component.query.verbosity = 4 see systemLog.component.query.verbosity documentation

  2. db.setLogLevel(...) see setLogLevel documentation.

your final config file should look like

storage:
   dbPath: "C:\mongodb\data"

systemLog:
   destination: file
   path: "C:\mongodb\mongo.log"
   component:
       query:
           verbosity: 2

operationProfiling:
    slowOpThresholdMs: 100
    mode: slowOp
Saleem
  • 8,728
  • 2
  • 20
  • 34
0

Connect from the mongo shell and run: db.setLogLevel(2,"query")

Harry
  • 86
  • 4