Running with Spring Boot, I get logs like this
c.m.i.d.l.SLF4JLogger : Command "insert" started on database "test" using a connection with driver-generated ID 3 and server-generated ID 13 to localhost:32795. The request ID is 13 and the operation ID is 11. Command: {"insert": "jobExecution", "ordered": true, "txnNumber": 1, "$db": "test", "$clusterTime": {"clusterTime": {"$timestamp": ...}
where c.m.i.d.l.SLF4JLogger
refers to com.mongodb.internal.diagnostics.logging.SLF4JLogger
.
I want to disable this logging, but if I change log4j2.xml to add:
<Logger level="INFO" name="com.mongodb.internal.diagnostics.logging"/>
it still shows, and the same applies if I set log levels via application-test.yml (for integration tests) as follows:
debug: false
logging:
level:
com.mongodb.internal.diagnostics.logging: INFO # Doesn't work
org.springframework.data.mongodb.core: INFO # Works
It turns out that there is some magic going on where the logger name logged, is not the same as what is used to enable or disable it.
debug: false
logging:
level:
org.mongodb: INFO # Works (what...!)