PHP logging and concurrency

php.internals

NAIK,ROSHAN (HP-Cupertino,ex1)

23 years ago
Looking at the sources I was surprised to see concurrency problems with logging. Multiple processes/threads seem to freely open, write and close the log file without bothering about any synchronization. The function php_log_error() seems to be the function that finally writes to the the log file specified in php.ini. This implementation could lead to a loss of logging information on heavy loads. Would that be correct ? If so, perhaps I (or someone else) could work on fixing it. -- Roshan

Rasmus Lerdorf

23 years ago
On Thu, 15 May 2003, NAIK,ROSHAN (HP-Cupertino,ex1) wrote:
> Looking at the sources I was surprised to see concurrency problems with > logging. > Multiple processes/threads seem to freely open, write and close the log file > without > bothering about any synchronization. > > The function php_log_error() seems to be the function that finally writes to > the > the log file specified in php.ini. > This implementation could lead to a loss of logging information on heavy > loads. > > Would that be correct ? If so, perhaps I (or someone else) could work on > fixing it.
We are only appending to the log file. Are you saying that you are on a non-Posix OS where file appends are not atomic? -Rasmus