Archive: How to write the logs of two programs concurrently into one log.


How to write the logs of two programs concurrently into one log.
I have the installer itself which creates a log by simple file operations, and I have a program called by the installer that also creates a log. The external program can display the output to screen and thus be captured that way by the execdos command, or it can be instructed to create a log directly.

How would I create a log that has the updates of both programs concurrently in one log. Not one after the other, but at the same time. Ex:

Installer: log line
Installer: log line
Installer: log line
External: log line
Installer: log line
External: log line


Something like have the installer log open for both write and read, read the written line and add it to the new file, similar trick should be used for the external program log, but how you would know when to add to the new file either the line from the installer log or the line from the external log?


Right, how would it know when a new line had been written?

Or what about this: I have the external program begin a log file, and I open it with the installer using the Append methodm and anytime i want I just write to the external file? Can two different programs access the same file at the same time and write to it?


You could have your installer handle everything by executing the other program with nsExec::ExecToStack and writing the output to your log.