简体   繁体   English

写入日志文件会导致写入冲突吗?

[英]Can writing to log files cause write conflicts?

I have a web server that host several PHP applications and I want to know if its possible to encounter a write conflict under heavy normal/traffic when writing log details to a text file. 我有一个托管多个PHP应用程序的Web服务器,我想知道在将日志详细信息写入文本文件时在正常/大量流量下是否可能遇到写入冲突。 In my case all applications using the same log file. 就我而言,所有应用程序都使用相同的日志文件。 If the possibility is high please give advises on how it could be reduced or avoided. 如果可能性很高,请就如何减少或避免它提供建议。

If you going to down vote, give reasons. 如果您要投反对票,请说明原因。

To avoid any issues you need to lock the file so only one application at a time is writing to the file. 为避免出现任何问题,您需要锁定文件,以便一次只将一个应用程序写入文件。 With no exceptions - you need to have a lock. 毫无例外-您需要锁。

If you have really loaded application(s) - you could choose some non-blocking logging daemon or storage 如果您确实已加载应用程序,则可以选择一些非阻塞日志记录守护程序或存储

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM