FIX No log trace was written when the JSON syntax was wrong

Add test for malformed JSON and log trace.