Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP log will not ignore repeated errors with ignore_repeated_errors = On

Although I have instructed php to only log an error once - i see the error over and over again in my log file. Any ideas why this directive would get ignored? I've restarted apache, etc.

like image 814
Jeremy Blum Avatar asked Dec 27 '09 00:12

Jeremy Blum


People also ask

How do I log errors in PHP?

To log errors in PHP, open the php. ini file and uncomment/add the following lines of code. If you want to enable PHP error logging in individual files, add this code at the top of the PHP file. ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);

How can you enable error reporting in PHP?

The quickest way to display all php errors and warnings is to add these lines to your PHP code file: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);


2 Answers

This directive will only stop the error from being logged again within the same script run. When the same script is run multiple times, you will still see that error every time.

like image 164
Ben James Avatar answered Oct 19 '22 22:10

Ben James


Besides the ignore_repeated_errors, there is also the ignore_repeated_source ini settings. I think that one would work for you and should stop showing the same error repeatedly, when same file is called over and over.

As PHP manual here says for it:

ignore_repeated_source - Ignore source of message when ignoring repeated messages. When this setting is On you will not log errors with repeated messages from different files or sourcelines

like image 45
userfuser Avatar answered Oct 20 '22 00:10

userfuser