Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got two separate programs running that each generate a log file (one is the output of device attached to a serial port, the other is the debug messages sent from a program commanding the aforementioned device).

What I'd like to be able to do is to correlate the debug messages printed by the commanding software with the responses received from the serial device. However, because the two programs are separate, it's not possible for me to have a look at a debug message in one file and figure out what data was sent back from the serial port at the same time.

What I'd like to find is something that can take the file streams of the two programs and combine them into one file.

I imagine a solution might work like this:

I'd set up the two programs to save their log files to two "virtual files", which would be created and monitored by this solution. The solution would continually monitor these virtual files and save their output to another file as an when data is written to the files.

share|improve this question

If these are commands that can be started from the command line, then you could do this with any good Unix shell, starting them as background activities using the & operator, piping both stdout and stderr through tee to write them into a log and display them.

Here's how you might do it using my Hamilton C shell. (You can do similar stuff with Cygwin bash.)

(command1 &; command2 &) |& tee logfile.txt

Two background processes under Hamilton C shell

The extra lines with the digits 1 to 4 in the screenshot are the background thread ids written to stderr by the & operator.

share|improve this answer
up vote 0 down vote accepted

The Dokan library allows you to create a virtual file system that you can then program to deal with the virtual files as you wish. I was able to put something together that used that to generate a virtual drive which my programs could log to. The software would take the data coming in from each file as and when it came and output that to single file that interlaced the two data streams.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .