Do not die on binary output with json logging

This is #947 agains 3.7 branch.