# PHP logging and concurrency

- Thread: https://externals.io/message/1552
- Original archive: https://news-web.php.net/php.internals/1552
- Started by NAIK on 2003-05-16T00:53:10+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #1552 — NAIK — 2003-05-16T00:53:10+00:00

URL: https://externals.io/message/1552#1552

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

---

## #1555 — Rasmus Lerdorf — 2003-05-16T01:42:35+00:00

URL: https://externals.io/message/1552#1555 · In reply to: #1552

> 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
