From: Robert Klemme Date: 2006-08-05T17:55:04+09:00 Subject: Re: writing from 3 sources to 1 file Une b�vue wrote: > i've an app with 2 daemons, i'd like to write all the log messages to > the same file. > > then i suppose i need to lock the file when one source is writing and > wait the file is unlocked for the other ? > > how this could be done in ruby, or is it automagic )) There is some locking support but watch out for NFS. There is Ara's solution at http://raa.ruby-lang.org/project/lockfile/ An alternative approach is to have a centralized logger daemon which is the only process writing the file. Your sources then could connect to it via DRB. This might even be more efficient because the logger daemon can keep the file open and even queue a number of log messages to write in order to decouple file writing and your sources activities. Kind regards robert