skmansfield
skmansfield

Reputation: 1443

MongoDB how do I reduce application logging

I have a web server application that uses MongoDB 3.4. I am using slf4j with Spring Boot to manage the application log. I believe Logback is the default logger for Spring Boot when using the slf4j facade. I have my logging level set to INFO for now. I am having trouble trying to reduce MongoDB logging. Over time, I get 1000's of MongoDB INFO log entries for every 1 or 2 application log entries making debugging difficult. I looked at the MongoDB log file and found the same issue. It had thousands of INFO log entries. I executed the following mongodb shell command,

db.runCommand({
    setParameter: 0,
    logComponentVerbosity: {
        "verbosity" : 0,
        "accessControl" : {
                "verbosity" : 0
        },
        "command" : {
                "verbosity" : 0
        },
        "control" : {
                "verbosity" : 0
        },
        "executor" : {
                "verbosity" : 0
        },
        "geo" : {
                "verbosity" : 0
        },
        "index" : {
                "verbosity" : 0
        },
        "network" : {
                "verbosity" : 0,
                "asio" : {
                        "verbosity" : 0
                },
                "bridge" : {
                        "verbosity" : 0
                }
        },
        "query" : {
                "verbosity" :0
        },
        "replication" : {
                "verbosity" : 0
        },
        "sharding" : {
                "verbosity" : 0
        },
        "storage" : {
                "verbosity" : 0,
                "journal" : {
                        "verbosity" : 0
                }
        },
        "write" : {
                "verbosity" : 0
        },
        "ftdc" : {
                "verbosity" : 0
        },
        "tracking" : {
                "verbosity" : 0
        }
    }
})

This dramatically lowered the number of MongoDB log entries. However, it did not affect the application log entries. I am still getting a very high number of not very useful MongoDB INFO log entries. Anyone know how I can reduce the number of MongoDB application log entries?

Upvotes: 0

Views: 709

Answers (1)

Strelok
Strelok

Reputation: 51441

Put

logging.level.org.mongodb=ERROR

in your application.properties file.

Upvotes: 1

Related Questions