Logging to a file in Node.js : Is it safe with clusters?

If I have 4, 8 or more threads & clusters on one box running this code, can there be resource contention over log files / file writers? If so, could you post an example that illustrates? So far all the testing I've done seems to indicate that write data won't get interwoven and won't get thrown away, but I am not 100% convinced

Thanks!

var errLog = fs.createWriteStream(... + '/error.log');
GLOBAL.dbLog = fs.createWriteStream(... + '/db.log');

There is no coordinating of threads or clustered processes, so the question comes down to whether the OS will allow multiple open write streams to a file. The default C flags for CreateWriteStream are O_WRONLY || O_CREAT || O_TRUNC. This indicates a first problem - all processes will be creating a new truncated file (when probably you wanted appending).

So assuming you're specifying w+ as a flag when creating the stream...

For Linux, this related question indicates that you will be ok as long as number of bytes is less than PIPE_BUF bytes (4096 on Linux, 512 on some other Unixes).

I'm not sure what the answer is on Windows.