in reply to Re: Writing to a log file without colliding
in thread Writing to a log file without colliding

I very much agree with the socket idea. It decouples the two processes further. As long as the shared memory only exists between each process and the log process/daemon then its just as decoupled as sockets. Prepend a timestamp to your log. Then you could come up with some cool sorting algorithm to make sure your log file is truly inorder if you make your timestamp look like

[yyyy-mm-dd_hh:mm:ss]|$log_entry
You can split the logfile based on the pipe and then substitute the square brackets,dashes,colons, and undescores with nulls. You then have an int that you can sort a hash (by key) with, and then have a truly ordered logfile. You would obviously re-sub the special characters in before writing back to the final log (if you wanted to keep them)


Grygonos