Though @Erwin's advice works in most cases, you should reconsider if a better architecture can help improve performance.
For example, Microsoft IIS server has many worker processes running, each sending log entries to IIS service process via a named pipe. And only IIS service process has the right to write to log files. In this way, worker processes do not need to lock log files, and the service process can cache entries and write them in batches.
It is very easy to follow IIS's approach and achieve good performance. without file locks.
(Updated: You can now use LogMaster4Net, which implements such an architecture based on UDP.)