question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to turn off MongoDB logging?

See original GitHub issue

Hi,

I’m currently running some tests with MongoDB. However, the YCSB benchmark generates a large amount of debug information as output. I normally execute the benchmark and redirect the output to a file for later analysis. However, with the amount of debug information the driver is generating these files are becoming unnecessarily large. At the very end of the run I finally get the required info such as average throughput, total runtime etc.

Example of execution:

python ./bin/ycsb run mongodb -P workloads/workloadc -p recordcount=100000 
-p operationcount=20000  -p mongodb.url=mongodb://localhost:27017/ycsb

Output (sample):

19:37:35.058 [Thread-2] DEBUG org.mongodb.driver.protocol.query - Sending query of namespace ycsb.usertable on connection [connectionId{localValue:2, serverValue:337}] to server localhost:27017
19:37:35.058 [Thread-2] DEBUG org.mongodb.driver.protocol.query - Query completed
19:37:35.058 [Thread-2] DEBUG org.mongodb.driver.protocol.query - Sending query of namespace ycsb.usertable on connection [connectionId{localValue:2, serverValue:337}] to server localhost:27017
19:37:35.058 [Thread-2] DEBUG org.mongodb.driver.protocol.query - Query completed
19:37:35.058 [Thread-2] DEBUG org.mongodb.driver.protocol.query - Sending query of namespace ycsb.usertable on connection [connectionId{localValue:2, serverValue:337}] to server localhost:27017

Is there any way to turn off the debugging? (preferably without modifying the source code)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
krutharcommented, Jun 2, 2016

@vreniers - the mongodb driver is setup to use slf4j and logback-classic so you actually need a logback.xml configuration present. I used something similar to this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
        <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
                <encoder>
                        <pattern>%d{HH:mm:ss.SSS}  %-5level %logger{36} - %msg%n</pattern>
                </encoder>
        </appender>

        <logger name="org.mongodb" level="WARN">
                <appender-ref ref="STDOUT"/>
        </logger>

        <root level="INFO">
                <appender-ref ref="STDOUT"/>
        </root>
</configuration>

Putting the logback.xml on the classpath was not sufficient, I had to specify it with a jvm property. Similar to:

python ./bin/ycsb run mongodb -P workloads/workloadc -p recordcount=100000 -p operationcount=20000 -p mongodb.url=mongodb://localhost:27017/ycsb -jvm-args="-Dlogback.configurationFile=/path/to/logback.xml"
0reactions
vrenierscommented, Jul 13, 2016

This works, thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you stop Java driver logging? - MongoDB
Try using the Logger 's Level OFF ; this is a special level that can be used to turn off logging. Usage: logger.setLevel(Level.OFF)...
Read more >
Mongo db log disabling - Stack Overflow
1) db.adminCommand({setParameter:1, logLevel:0 }) // from mongo shell, this can be set using config file too · 2) disable slow query profiling in ......
Read more >
How to disable mongodb connection logs?
If you want to modify any of these (verbosity) settings , you can configure the systemLog.verbosity and systemLog.component.<name>.verbosity ...
Read more >
How to disable mongoDB java driver logging?
I am trying to disable log outputs of mongo-java-driver-3.0.0 . ... Enable MongoDB logging in general System.setProperty("DEBUG.
Read more >
Deactivate logging in the Java-driver - Google Groups
Logger.getLogger("com.mongodb").setLevel(Level.OFF); But that doesn't seem ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found