I have a linux program(the language doesn't matter) which prints it's log onto stdout.
The log IS needed for monitoring of the process.

Now I'm going to parallelize it by fork'ing or using threads.

**The problem: resulting stdout will contain unreadable mix of unrelated lines...**

And finally **The question: How would you re-construct the output logic for parallel processes ?**