Java driver for MongoDB does not provide any utility classes that could help with building update queries. If you want to create a query to update or increment field values, you usually have to use
BasicDBObjectBuilder. This is intuitive approach, but queries defined in such a way are quite hard to read and maintain.
Log4j doesn't allow to catch stdout and stderr messages out of the box. However, you can still intercept them with a custom output stream, which is especially useful when you have to log data that third-party libraries write to the standard streams.
This has already been done by Jim Moore (have a look at the
LoggingOutputStream in the log4j source code). The issue is that this
org.apache.log4j.Priority which are now partially deprecated.