Improved logging when a command fails.