in reply to Writing to a log file without colliding
There are other options
Maybe you can write 2 files with time stamps and merge them at the end of a run based on time.
Or have a separate process perform the logging (ie create shared memory or some other ipc like sockets). The logging process just gets data from other processes and stores in a file. Other processes could just place data they want logged in shared memory (or send via socket however its set up) without blocking or worrying about locks. This is significantly more complicated but may work better in the long run.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Writing to a log file without colliding
by Grygonos (Chaplain) on Aug 17, 2004 at 14:13 UTC |