Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-932

How to disable driver logging

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.11.2
    • Component/s: Error Handling
    • Labels:
      None

      The following code can be used to change the level at which events are logged by clients of the driver ...

      import java.util.logging.Logger;
      Logger mongoLogger = Logger.getLogger( "com.mongodb" );
      mongoLogger.setLevel(Level.SEVERE);

      However, rather than have to write this code in many different places, I'd really like to have the ability to set the logging level in a single place. For example, the Amazon SDK, hc.apache and others allow me to do this in a log4j.properties file like so:

      1. Uncomment to turn off all logging from the SDK
        log4j.logger.com.amazonaws=OFF
      1. More examples – adjust to see more / less logging
        #log4j.logger.com.amazonaws.ec2=WARN
        #log4j.logger.httpclient.wire=WARN

      log4j.logger.org.apache.http=OFF
      #log4j.logger.org.apache.http=DEBUG
      #log4j.logger.org.apache.http.wire=ERROR
      #log4j.logger.org.apache.http.impl.conn=ERROR
      #log4j.logger.org.apache.http.impl.client=ERROR
      #log4j.logger.org.apache.http.client=ERROR

      Is there any way to do something like this with the mongoDB java driver?

            Assignee:
            Unassigned Unassigned
            Reporter:
            beast Alex Ryan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: