Instead of using a flat log file and trying to deal with the locking/overwriting problems that entails, have you considered logging these into a Free, solid database engine that supports row-level locking such as PostgreSQL?
in reply to Writing to a file
This approach might also have the side benefit of letting you find a way around the possibility of running out of space in your process table. And, you could write simple modules that could then index the log files and sort them by date or machine or what-have-you afterwards.
Probably not exactly what you're looking for, but it's a thought. =}