Open eroltoker opened 7 months ago
With the FPM runtime, just like on any server, nothing is logged by default. You have to set up an error handler. You can use a framework or a library like Monolog.
Hi @mnapoli -
First, I implemented bref logger with brefv1: https://github.com/brefphp/logger This seems to be working fine
The issue is with native PHP errors for example things that result in default 500 http response codes (fatal exceptions, syntax errors, etc) are not visible in cloudwatch logs.
According to the documentation here: https://bref.sh/docs/environment/logs
"By default, all PHP errors, warnings and notices emitted by PHP will be forwarded into CloudWatch. That means that you don't have to configure anything to log errors, warnings or uncaught exceptions."
With v1, I didn't need to do anything to get this to show up in the logs.
Here is an example of a request served by the php-fpm-83 runtime in v2 that results in a 500 error (because it is in fact a syntax error), but it doesn't show up in the cloudwatch logs
Could you help point me to what I'm missing?
I was able to reproduce the v1 behavior by creating a custom php.ini file in my project and adding these settings.
; Turn off displaying errors display_errors = Off
; Log errors to the server's error log (stderr) log_errors = On error_log = /dev/stderr
; Set the level of error reporting error_reporting = E_ALL
I'm going to reopen this because I'm not sure whether we want to change that, I want to keep the idea in mind.
I think it would make sense, at the very least, to have this as a reminder in the documentation for people getting started. Especially if they are coming into this from a background where php-fpm wasn't what they were using (as was in my case).
Description: Since upgrading to brefv2, i'm no longer seeing error messages in the cloudwatch logs.
For example:
This only started happening after the upgrade from brefv1 to brefv2.
Am I doing something wrong?
serverless.yml plugins: