Fix parallel command execution logging parallely - GH434

Also add unit tests that reproduce the problem
Merge pull request #457 from gnufied/master

Fix parallel command logging properly