Patrick M
Patrick M

Reputation: 166

MongoDB - How to use setParameter inside a configuration file

I'm trying to set a custom value for the logLevel parameter to my MongoDB installation. The standard way to do it seems to pass a --setParameter argument to the mongod.exe executable.

But I read the Configuration File Options page, and it indicates that it is possible to include the setParameter within a configuration file.

What's the syntax in this case?

Upvotes: 2

Views: 2424

Answers (1)

Stennie
Stennie

Reputation: 65373

As of MongoDB 2.4, there are now version-specific online manuals for MongoDB. If you look at the navigation at the top left of the page, you should see a dropdown with available manual versions (eg. "2.4 (current)" or "2.2"). The default manual matches the current stable production release.

The setParameter configuration syntax is new to 2.4 (and noted as such in the 2.4 manual).

The historical syntax for setting logLevel/verbosity is to use an increasing number of vs (for verbosity, aka --verbose). So v is loglevel 1, vv is loglevel 2, and so on.

This config setting will work in MongoDB 2.2 and older versions as well as MongoDB 2.4:

// Set verbosity to logLevel 3:
vvv = true

In general you won't want to set a logLevel higher than 1 unless trying to collect information for troubleshooting purposes. The normal level of logging verboseness is 0; higher levels can generate a lot of logging details.

Upvotes: 1

Related Questions