Skip to content

Unable to see messages logged to STDERR in docker logs #592

@siddjain

Description

@siddjain

We are using the wordpress:php7.4-fpm-alpine image. We are logging to STDERR using following as example:

error_log($msg, 3, '/dev/stderr');

but do not see the message in Docker logs. If we replace /dev/stderr with a local filename such as /var/www/html/wp-debug.log the message does appear there.

Things we tried (none of which worked):

  • replace /dev/stderr with /proc/self/fd/2
  • replace /dev/stderr with /proc/1/fd/2

we have verified catch_workers_output is set to yes in /usr/local/etc/php-fpm.d/docker.conf.

below are the different kinds of error messages in wordpress logs:

[23-Mar-2021 18:48:55 UTC] PHP Warning:  error_log(/dev/stderr): failed to open stream: No such file or directory in /var/www/html/wp-content/logging.php on line 11
[23-Mar-2021 20:26:06 UTC] PHP Warning:  error_log(/proc/1/fd/2): failed to open stream: Permission denied in /var/www/html/wp-content/logging.php on line 11
[23-Mar-2021 21:13:15 UTC] PHP Warning:  error_log(/proc/self/fd/2): failed to open stream: No such file or directory in /var/www/html/wp-content/logging.php on line 11

the /dev/stderr does clearly exist:

bash-5.0# ls -al /dev/stderr
lrwxrwxrwx    1 root     root            15 Mar 23 20:04 /dev/stderr -> /proc/self/fd/2
bash-5.0# ls -al /proc/self/fd/2
lrwx------    1 root     root            64 Mar 23 21:18 /proc/self/fd/2 -> /dev/pts/0
bash-5.0# ls -al /dev/pts/0
crw--w----    1 root     tty       136,   0 Mar 23 21:18 /dev/pts/0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions