You are currently viewing an older version of the Java driver documentation.
For the most recent version of the reference documentation, see our MongoDB Java Driver documentation site.

Logging

By default, logging is enabled via the popular SLF4J API. Logging is optional: the driver will use SLF4J if the driver detects the presence of SLF4J API (class org.slf4j.Logger) in the classpath. Otherwise, the driver will log a single warning via JUL (java.util.logging) and otherwise logging will be disabled.

The driver uses the following logger names:

  • org.mongodb.driver: the root logger
    • cluster: for logs related to monitoring of the MongoDB servers to which the driver connects
    • connection: for logs related to connections and connection pools
    • protocol: for logs related to protocol message sent to and received from a MongoDB server
      • insert: for logs related to insert messages and responses
      • update: for logs related to update messages and responses
      • delete: for logs related to delete messages and responses
      • query: for logs related to query messages and responses
      • getmore: for logs related to getmore messages and responses
      • killcursor: for logs related to killcursor messages and responses
      • command: for logs related to command messages and responses
    • uri: for logs related to connection string parsing
    • management: for logs related to JMX
On this page