1

I am getting a LOT of entries in the Drupal dblog (watchdog) about a deprecated PHP function, as described here - Debug PseudoConstant

I'm trying to debug a different issue and the presence of these (hundreds) of messages is making it very difficult.

Is there a way of turning down the logging level so that deprecated function messages are not shown? It seems odd to include them, because admins cannot even do anything about it, it's just for developers.

(I know I can filter the log by component and by severity; however, the messages I am interested in are also marked "civicrm" and "debug", so that doesn't help. And in any case, the Drupal UI only shows recent messages, so when there are hundreds of irrelevant ones, it doesn't have room for many of the ones I want to see.)

1

The types of PHP errors and warnings being logged to Drupal Watchdog typically reflect the level of error reporting set for the webserver. If you can edit your vhost config or .htaccess, you could change the error reporting level. Refer to http://php.net/manual/en/errorfunc.constants.php for the different error levels.

Based on your request, you probably want to disable/exclude error reporting for the following level:

  • 8192 E_DEPRECATED

In .htaccess, you'd add php_admin_value error_reporting 22527 to disable just E_DEPRECATED.


Should you find that you're still getting other deprecated warnings after applying the change (and possibly restarting server if change was made in vhost), you may want to also exclude the following error level/type:

  • 16384 E_USER_DEPRECATED

See https://stackoverflow.com/questions/5628148/disable-e-deprecated-in-php-error-log for more background on how you can get the bitwise value (error level) for a custom combination of error types.

  • Can you please add where to put that line in .htaccess? I put it inside the <IfModule mod_php5.c> part, where it seemed to fit , and it caused a 500 error – naomi Oct 16 '17 at 11:54
  • In php.ini I have "error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT". Why wouldn't that stop the deprecated messages? – naomi Oct 16 '17 at 11:57
  • If adding to the .htaccess file, you should be able to add it near the top of the file, outside of the module conditionals. – Anson W Han Oct 17 '17 at 4:13
  • If you add it to php.ini, be sure to restart apache/php for the rules to kick in. If that doesn't work still, then you may be editing the wrong php.ini or your site has somewhere in its php code an explicit call to report said errors – Anson W Han Oct 17 '17 at 4:15
  • I didn't edit php.ini. It was already like that – naomi Oct 17 '17 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.