Fix parallel command logging properly

Also add unit tests that reproduce the problem