On Jan 4, 10:29 am, Antoine Pitrou <solip...@pitrou.net> wrote: > Le Mon, 04 Jan 2010 08:09:56 -0800, Brian D a écrit : > > > > > What I've seen is that flush() alone produces a complete log when the > > loop finishes. When I used fsync(), I lost all of the write entries > > except the first, along with odd error trap and the last entry. > > Perhaps you are writing to the file from several threads or processes at > once? > > By the way, you shouldn't need fsync() if you merely want to look at the > log files, because your OS will have an up-to-date view of the file > contents anyway. fsync() is useful if you want to be sure the data has > been written to the hard disk drive, rather than just kept in the > operating system's filesystem cache.
Sure -- I hadn't considered how threads might affect the write process. That's a good lead to perhaps fixing the problem. Thanks for your help, Antoine. -- http://mail.python.org/mailman/listinfo/python-list