Ensure we always log commands and log the right thing.
Manual merge of 6f592d9