Repository navigation
Logging Parallel Activities
By default when using a <parallel> task, despite all tasks executing at the same time, only the logging for the first task is output to the console at first. All other tasks still produce log messages but those messages are buffered until previous tasks finish executing. Once the first task finishes, the second task's logging output, including any that was buffered, is displayed in the console. Once that task completes, the next task follows suit and so on.
In this way, once all tasks execute, the console output looks identical to how it would had the tasks been executed in sequence.
For example, this parallel:
<parallel>
<pcall target="A"/>
<pcall target="B"/>
<pcall target="C"/>
</parallel>
Would result in (approximately) this log output:
A:
[Log output from target A]
[Log output from target A]
B:
[Log output from target B]
[Log output from target B]
[Log output from target B]
C:
[Log output from target C]
Despite A, B, and C executing (and even finishing) simultaneously, or even out of order, the log output shows their output sequentially in the order they are declared in the task.
If the neat, orderly logging specified above isn't your style, there is a more chaotic option.
When cacophony="true" is specified on a <parallel> task, all log messages are output immediately, rather than being buffered until the previous task finishes. See below for an example.
WARNING: Certain loggers, such as the XmlLogger, will break if cacophony logging is enabled.
For example, this parallel:
<parallel>
<pcall target="A"/>
<pcall target="B"/>
<pcall target="C"/>
</parallel>
Could result in this log output:
A:
B:
[Log output from target B]
C:
[Log output from target B]
[Log output from target B]
[Log output from target C]
[Log output from target A]
[Log output from target B]
As you can see, there is no defined order in how logging messages are output to the console; they are output as soon as they happen on their respective threads.