Welcome Guest, Not a member yet? Register   Sign In
PHP warning not logged in production env
#1

(This post was last modified: 03-01-2021, 12:53 AM by ViLar.)

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;
echo 
$foo

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?
Reply
#2

You have to change the boot file.

See https://github.com/codeigniter4/CodeIgni...on.php#L11
Reply
#3

(This post was last modified: 03-01-2021, 01:37 AM by ViLar.)

(03-01-2021, 01:20 AM)kenjis Wrote: You have to change the boot file.

See https://github.com/codeigniter4/CodeIgni...on.php#L11

Thank you it worked well
However I don't find any mention of this in the documentation, might be a little PR coming in.
Reply
#4

Yes, probably this is undocumented.

There is a short description about boot files,
https://codeigniter4.github.io/CodeIgnit...boot-files
but it might be better that the logging page has a note about this.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB