Improvements to debug logging:

1: it is no longer on by default if DEBUG is defined non-zero
2: strange network responses are logged more comprehensively