Hello,

On Tue, 26 Sep 2006 05:28:15 +0900, Frank Reiff <reiff / publicspace.net>  
wrote:

> My problem: "How can I write (append) to the same log file from multiple
> interpreter instances at least potentially simultaneously?"

Take advantage of your operating system and use File's flock features.
For example this code snippet should do what you are asking for:

File.open("foo.txt", "w") do |f|
   f.flock(File::LOCK_EX)
   f.puts "Hello from #{Process.pid}"
   f.flock(File::LOCK_UN)
end

Try running the above code with multiple instances of ruby and loop.
You should notice that each entry is on a new line with no data being
clipped.

I hope that helps,
Zev