Improved logging for shell commands