Move logging from runCommand into locations with more context.