Nginx has a main process and many work processes, they all write error log to the same file. I have tried multi-processes write to the same file, this will cause an error and some data will be overwritten. But I have read nginx codes and do find any locks
while write to the log file, so my question is why do nginx processes write to the same file without errors? Such as, two worker processors write log at the same time, why is there no data overwrite?
Asked
Active
Viewed 25 times
0

Yongqi Z
- 605
- 8
- 20
-
What do you mean by "Why do nginx processes write to the same file without errors?"? – Pluto Jul 04 '23 at 02:05
-
@VictorL.Such as, two worker processors write log at the same time, why is there no data overwrite? I didn't find any locking logic when writing logs – Yongqi Z Jul 04 '23 at 02:29