Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter is logging errors suppressed with @
#1

[eluser]DisgruntledGoat[/eluser]
Just trying to get my head around error reporting and logging in CI. After a ton of searching and changing settings in CI and php.ini (which CI routinely ignores), I now have the following:

- The 'ENVIRONMENT' setting in index.php, set to 'production' (i.e. error_reporting(0)).
- $config['log_threshold'] in config/config.php, set to 1.

In other words, errors are not displayed on the site but are logged to application/logs.

However, CI is still logging errors when they are explicitly suppressed with @. Is this a bug? I expect that if I specifically suppress errors that they would not even be logged.
#2

[eluser]Aken[/eluser]
From http://php.net/manual/en/language.operat...ontrol.php

Quote:If you have set a custom error handler function with set_error_handler() then it will still get called, but this custom error handler can (and should) call error_reporting() which will return 0 when the call that triggered the error was preceded by an @.

CI uses a custom error handler to retrieve PHP errors and both display them in CI style (where appropriate) as well as log them.
#3

[eluser]DisgruntledGoat[/eluser]
OK so doesn't that mean that CI is doing things wrong itself? CI should be calling error_reporting() and not logging things when it's set to 0.
#4

[eluser]CroNiX[/eluser]
If you feel this is a big enough issue (an extra line in your log file), feel free to file a bug report on github.
#5

[eluser]DisgruntledGoat[/eluser]
It's actually a dozen or so extra lines, on every page load. Unfortunately it's from external code I can't (and shouldn't need to) modify. It just makes it more difficult to find real errors. Thanks for the replies though, I'll open a bug report.

EDIT: a similar issue was already reported so I commented on that instead.




Theme © iAndrew 2016 - Forum software by © MyBB