HI,
How can I set the log levels in php?
Now the logs of my webserver get filled by notice errors,
but I don't need them.
Solved : php log files set error levels
Solved : php log files set error levels
Last edited by mister_v on Thu Apr 28, 2016 5:47 pm, edited 1 time in total.
Re: php log files set error levels
You can set what need to be logged by adapting error_reporting in php.ini.
or
This will log all error except for notices and coding standards warnings
and this will also not log depreciated errors:
Code: Select all
/etc/php.ini
Code: Select all
/etc/php5/apache2/php.ini
This will log all error except for notices and coding standards warnings
Code: Select all
error_reporting = E_ALL & ~E_NOTICE
Code: Select all
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
Re: php log files set error levels
Here is a full list:
E_ALL - All errors and warnings (includes E_STRICT as of PHP 5.4.0)
E_ERROR - fatal run-time errors
E_RECOVERABLE_ERROR - almost fatal run-time errors
E_WARNING - run-time warnings (non-fatal errors)
E_PARSE - compile-time parse errors
E_NOTICE - run-time notices (these are warnings which often result
from a bug in your code, but it's possible that it was
intentional (e.g., using an uninitialized variable and
relying on the fact it is automatically initialized to an
empty string)
E_STRICT - run-time notices, enable to have PHP suggest changes
to your code which will ensure the best interoperability
and forward compatibility of your code
E_CORE_ERROR - fatal errors that occur during PHP's initial startup
E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's
initial startup
E_COMPILE_ERROR - fatal compile-time errors
E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
E_USER_ERROR - user-generated error message
E_USER_WARNING - user-generated warning message
E_USER_NOTICE - user-generated notice message
E_DEPRECATED - warn about code that will not work in future versions
of PHP
E_USER_DEPRECATED - user-generated deprecation warnings
E_ALL - All errors and warnings (includes E_STRICT as of PHP 5.4.0)
E_ERROR - fatal run-time errors
E_RECOVERABLE_ERROR - almost fatal run-time errors
E_WARNING - run-time warnings (non-fatal errors)
E_PARSE - compile-time parse errors
E_NOTICE - run-time notices (these are warnings which often result
from a bug in your code, but it's possible that it was
intentional (e.g., using an uninitialized variable and
relying on the fact it is automatically initialized to an
empty string)
E_STRICT - run-time notices, enable to have PHP suggest changes
to your code which will ensure the best interoperability
and forward compatibility of your code
E_CORE_ERROR - fatal errors that occur during PHP's initial startup
E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's
initial startup
E_COMPILE_ERROR - fatal compile-time errors
E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
E_USER_ERROR - user-generated error message
E_USER_WARNING - user-generated warning message
E_USER_NOTICE - user-generated notice message
E_DEPRECATED - warn about code that will not work in future versions
of PHP
E_USER_DEPRECATED - user-generated deprecation warnings
Re: php log files set error levels
I changed the value of error_reporting, but it is not working.
What do I do wrong.
What do I do wrong.
Re: php log files set error levels
Are you sure you don't overwrite the error_reporting somewhere later in the file?
I had that problem once.
I had that problem once.
Re: Solved : php log files set error levels
Thanks, there are indeed 2 lines with error_reporting.
I also edited the second line, and now it works.
Why are there 2 lines?
I also edited the second line, and now it works.
Why are there 2 lines?