![]() |
PHP warning not logged in production env - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: PHP warning not logged in production env (/showthread.php?tid=78711) |
PHP warning not logged in production env - ViLar - 03-01-2021 I recently stepped in a real problem that I can't overcome. Whenever I switch my application from development mode to production mode, CI4 stops logging my PHP warning. For example this code : PHP Code: $bar = 20; Should throw a warning Undefined variable $foo Everything's alright in my development environment with this log : Code: CRITICAL - 2021-03-01 08:44:52 --> Undefined variable: foo But nothing happens if I switch to CI_ENVIRONMENT = production. Warning is bypassed and not logged. I tried to switch the $threshold variable in app/Config/Logger.php to 5 or 9 or even an array of different values but it doesn't change anything. Did you witness such a behavior in your app? Should I open an issue in GitHub or am I missing something here? RE: PHP warning not logged in production env - kenjis - 03-01-2021 You have to change the boot file. See https://github.com/codeigniter4/CodeIgniter4/blob/1416e4b1d9370cd3576f8b7f9810c0eb2fe2792f/app/Config/Boot/production.php#L11 RE: PHP warning not logged in production env - ViLar - 03-01-2021 (03-01-2021, 01:20 AM)kenjis Wrote: You have to change the boot file. Thank you it worked well However I don't find any mention of this in the documentation, might be a little PR coming in. RE: PHP warning not logged in production env - kenjis - 03-01-2021 Yes, probably this is undocumented. There is a short description about boot files, https://codeigniter4.github.io/CodeIgniter4/general/environments.html#boot-files but it might be better that the logging page has a note about this. |