How to get php-fpm to log to stdout / stderr when running in a docker container

Solution 1:

Ok, the way to do this is to send the error and the access logs to the following address:

/proc/self/fd/2

In php5-fpm.log add:

access.log = /proc/self/fd/2
error_log = /proc/self/fd/2

Solution 2:

Note that the baked in fpm config for the latest version of the official PHP fpm docker image writes to the standard streams:

error_log = /proc/self/fd/2

...

; if we send this to /proc/self/fd/1, it never appears
access.log = /proc/self/fd/2