Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

Cannot change logging level

I wanted to change logging level to investigate some issue but I can’t find a way to actually do it :
I tried a
db.setLogLevel(2)
or
db.setLogLevel(2, 'query')
in mongos but I did not see any change in the logs. No “D” messages.

db.getLogComponents is consistant with my changes
What did I miss ?

Hi Remi,

Welcome to MongoDB Community!

On the mongos, try running db.setLogLevel(5,"query").

There may not be much to see at the mongos, most of the query work occurs on the shards.

As soon as you’re confident that the log contains the information you are looking for, you can turn off debug logging by running the command db.setLogLevel(0) . There’s no need to have debugging enabled for the entire load test. Verify that the debug info is no longer being written to the log.

Let us know how it goes.

Regards,
Martin

Hi Martin,

Do you mean that the logLevel set at the mongos> prompt only affects the mongos I am connected to and that it won’t change the logging level of the shards ? That would explain why I don’t see any difference…

Best regards.