log errors as JSON instead of text