We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Log to the php default log

I would like to write something to the same logging as php does (specified by the apache/nginx config). Can I use one of the logging adapter for that or should I fallback to the native php error_log() ?

edited Mar '16

You could use ini_get("error_log") like so:

$logger = new \Phalcon\Logger\Adapter\File(ini_get('error_log'));


10.1k

The error_log of the ini_het is empty in my setup. Nginx is catching the errors and logs them in the right file. I assume it's using some standard output that nginx or apache graps. I tried StreamAdapter('php://stdout') but that wasn't working.

This might help, keep the stdout streamadapter:

; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
; Default Value: no
catch_workers_output = yes