Various and sundry fixes

Fixes for bugs uncovered by @bbangert's [tester](https://github.com/bbangert/push-tester) and my [Go port](https://github.com/kitcambridge/push-tester-go), along with a Heka logging refactor.
I added this for sending logs to a Heka instance running in a Docker container.