voldemort/voldemort — pull request #85 by pbailis (2012-07-20 21:35:17+00:00)
Title: Enable log4j.properties in all tests and fix hidden debug NPE

Currently, it appears log4j.properties is not picked up by all of the unit tests.

As an example, on trunk, edit `src/java/log4j.properties`:

log4j.rootLogger=DEBUG, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

Then run `ant junit-test -Dtest.name=voldemort.server.EndToEndTest`. It will pass. However, `jnit-test` is not currently using the `log4j.properties` file! If you include the `log4j.properties` file by applying commit f61b4652ec9cc5ce5934fb783e032a75a15a98a9, you will find that the test now fails.

Commit ffff0f7f169fc91d96c161dcc970902594ffa282 added the log4j.properties file to the `junit` target but not `junit-long` or `junit-test`. This possibly explains some of the seemingly spurious failures we were seeing. I believe that f61b4652ec9cc5ce5934fb783e032a75a15a98a9 fixes this behavior by configuring log4j for all tests.

The failures (which were previously masked) are due to a NullPointerException [in SocketStore](https://github.com/voldemort/voldemort/blob/fa3d6f6ff2189a0860ae98535a84cdc5372b168b/src/java/voldemort/store/socket/SocketStore.java#L448) introduced by commit fa3d6f6ff2189a0860ae98535a84cdc5372b168b. The basic problem is that a PUT returns null, and we call `(null).toString()`. This means that, in trunk, enabling `DEBUG` logging in `SocketStore` will result in timeouts for PUT requests to stores where `RequiredWrites` is greater than 1. The one-line change in 1d9d8e8f4878a03625eba2cd2b8484eac94420bc fixes this problem.