I have the debug option set to false on production, as it should be. In Cloudflare, however, I can see that some pages return HTTP 500 error response codes. I searched the nginx and php-fpm logs for information, but found nothing useful. I didn’t get an error message as I would have if debug was set to true.
How could I debug those errors without compromising the security of the site? I think that when debug is set to false, Kirby should log errors with error_log(), so that system administrators can have a look and figure out what’s wrong.
I think errors that are caused in the Kirby context are logged in the error logs. HTTP 500 errors can be caused by multiple different causes, including wrong server configuration (e.g memory limits, wrong permissions), too long script runtimes etc. Check your PHP configuration, what type of errors are actually logged.
Are you sure your 500 errors are errors that would be caught by Kirby when debug is set to true? Many such errors happen, before they even reach the application.
I can’t test it that easily. I get the errors on pages that otherwise work. My theory is that happens due to our use of Cloudflare’s geolocation headers, since these errors are rare and happen in more isolated countries. Perhaps there are no headers set under some circumstances and our site logic receives a null value.
But anyway, if Kirby is to log any errors while in debug mode, where would they be on a Linux system? I searched the *.log files in /var/log/php-fpm, but found nothing useful.