in reply to Do I need to lock log files?

If you have the possibility that two processes may access one file for writing at the same time, lock it.

See flock. See also How can I lock a file? in perlfaq5.