-
Type:
Task
-
Resolution: Done
-
Priority:
Minor - P4
-
None
-
Affects Version/s: 2.11.2
-
Component/s: Error Handling
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
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:
- Uncomment to turn off all logging from the SDK
log4j.logger.com.amazonaws=OFF
- 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?