php / php/php-src

FPM: error_log entries all on same line

Open
#10,890 10 comments 3 reactions 1 assignee View on GitHub

@bukka is already working on this.

Since Apr 10, 2023.

Feature SAPI: fpm
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

The following code:

<?php
echo 'try err msg on line 1<p>';
error_log("err on line 1");
echo 'try err msg on line 2<p>';
error_log('err on line 2');
echo 'try err msg on line 3<p>';
error_log('err on line 3');
?>

Resulted in this output:

[Mon Mar 20 15:07:40.253904 2023] [proxy_fcgi:error] [pid 122391:tid 140026615572224] [client 129.71.34.33:53261] AH01071: Got error 'PHP message: err on line 1PHP message: err on line 2PHP message: err on line 3'

But I expected something similar to this instead:

[Mon Mar 20 13:25:38.221700 2023] [fcgid:warn] [pid 97183:tid 140026511869696] [client 129.71.34.33:57883] mod_fcgid: stderr: err on line 1
[Mon Mar 20 13:25:38.221753 2023] [fcgid:warn] [pid 97183:tid 140026511869696] [client 129.71.34.33:57883] mod_fcgid: stderr: err on line 2
[Mon Mar 20 13:25:38.221762 2023] [fcgid:warn] [pid 97183:tid 140026511869696] [client 129.71.34.33:57883] mod_fcgid: stderr: err on line 3

If I change back to FCGId I do get the above three individual log entries -- in fact my example above, as you can see, is from FCGId.

Either I am missing a setting in my PHP and/or FPM config (some flush or cache setting?) or FPM is the culprit here :-) If I send three different distinct error messages, each should be standalone and not concatenated together -- again FCGId logs things properly.

PHP Version

PHP 8.2.4

Operating System

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.