Page 1 of 1
					
				Solved : php log files set error levels
				Posted: Sun Apr 17, 2016 7:50 pm
				by mister_v
				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.
			 
			
					
				Re: php log files set error levels
				Posted: Mon Apr 18, 2016 7:37 pm
				by chris
				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
Code: Select all
error_reporting = E_ALL & ~E_NOTICE
and this will also not log depreciated errors:
Code: Select all
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
 
			
					
				Re: php log files set error levels
				Posted: Mon Apr 18, 2016 7:39 pm
				by chris
				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
			 
			
					
				Re: php log files set error levels
				Posted: Tue Apr 19, 2016 6:14 pm
				by mister_v
				I changed the value of error_reporting, but it is not working.
What do I do wrong.
			 
			
					
				Re: php log files set error levels
				Posted: Tue Apr 19, 2016 8:04 pm
				by chris
				Are you sure you don't overwrite the error_reporting somewhere later in the file?
I had that problem once.
			 
			
					
				Re: Solved : php log files set error levels
				Posted: Thu Apr 28, 2016 5:48 pm
				by mister_v
				Thanks, there are indeed 2 lines with  error_reporting.
I also edited the second line, and now it works.
Why are there 2 lines?