Answers.Body: <p>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 <a href="http://php.net/manual/en/errorfunc.constants.php" rel="nofollow noreferrer">http://php.net/manual/en/errorfunc.constants.php</a> for the different error levels.  </p>
  
  <p>Based on your request, you probably want to disable/exclude error reporting for the following level:</p>
  
  <ul>
  <li>8192     E_DEPRECATED</li>
  </ul>
  
  <p>In .htaccess, you'd add <code>php_admin_value error_reporting 22527</code> to disable just E_DEPRECATED.  </p>
  
  <hr>
  
  <p>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:</p>
  
  <ul>
  <li>16384 E_USER_DEPRECATED</li>
  </ul>
  
  <p>See <a href="https://stackoverflow.com/questions/5628148/disable-e-deprecated-in-php-error-log">https://stackoverflow.com/questions/5628148/disable-e-deprecated-in-php-error-log</a> for more background on how you can get the bitwise value (error level) for a custom combination of error types.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-16T11:54:50.377Z
Answers.Text: 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
Answers.UserDisplayName: naomi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-16T11:57:01.593Z
Answers.Text: In php.ini I have "error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT". Why wouldn't that stop the deprecated messages?
Answers.UserDisplayName: naomi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-17T04:13:25.640Z
Answers.Text: If adding to the .htaccess file, you should be able to add it near the top of the file, outside of the module conditionals.
Answers.UserDisplayName: Anson W Han
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-17T04:15:47.217Z
Answers.Text: 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
Answers.UserDisplayName: Anson W Han
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-17T08:19:34.810Z
Answers.Text: I didn't edit php.ini. It was already like that
Answers.UserDisplayName: naomi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-18T04:13:33.760Z
Answers.Text: recommend you edit it to reflect:
   "error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED & ~E_STRICT"
  
  then reboot/restart the web server and clear your logs before surfing around the site to see if it did the trick.
Answers.UserDisplayName: Anson W Han
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-18T15:05:13.390Z
Answers.Text: Thanks @Anson but no, editing php.ini to include "& ~E_DEPRECATED " did not help.
Answers.UserDisplayName: naomi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-18T17:30:20.217Z
Answers.Text: I tried adding "php_admin_value error_reporting 22527" in various places in .htaccess and it always caused a 500 error.
Answers.UserDisplayName: naomi
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-09T16:16:05.447Z
Answers.Text: Note that php_admin_value can be used only in Apache config files (e.g. httpd.conf) and not in .htaccess. In .htaccess, use php_value instead. https://www.php.net/manual/en/configuration.changes.php
Answers.UserDisplayName: BobS
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-10-14T03:49:12.060Z
Answers.LastActivityDate: 2017-10-14T03:49:12.060Z
Answers.UserDisplayName: Anson W Han
Body: <p>I am getting a LOT of entries in the Drupal dblog (watchdog) about a deprecated PHP function, as described here -
   <a href="https://civicrm.stackexchange.com/questions/19620/debug-pseudoconstant">Debug PseudoConstant</a></p>
  
  <p>I'm trying to debug a different issue and the presence of these (hundreds) of messages is making it very difficult.</p>
  
  <p>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.</p>
  
  <p>(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.)</p>
  
Tags: <drupal><error><php><logging>
Title: Any way to avoid "deprecated function" messages in the Drupal dblog?
ThreadText: # Any way to avoid "deprecated function" messages in the Drupal dblog?
  
  (Asked by: username_0 on 2017-10-11)
  
  I am getting a LOT of entries in the Drupal dblog (watchdog) about a deprecated PHP function, as described here -
  [Debug PseudoConstant](https://civicrm.stackexchange.com/questions/19620/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.)
  
  **Tags:** drupal, error, php, logging
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-10-14. Score: 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.
  
  > **Comments:**
  > **username_0**: 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  
  > **username_0**: In php.ini I have "error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT". Why wouldn't that stop the deprecated messages?  
  > **username_1**: If adding to the .htaccess file, you should be able to add it near the top of the file, outside of the module conditionals.  
  > **username_1**: 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  
  > **username_0**: I didn't edit php.ini. It was already like that  
  > **username_1**: recommend you edit it to reflect:  "error_reporting = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED & ~E_STRICT"  then reboot/restart the web server and clear your logs before surfing around the site to see if it did the trick.  
  > **username_0**: Thanks @Anson but no, editing php.ini to include "& ~E_DEPRECATED " did not help.  
  > **username_0**: I tried adding "php_admin_value error_reporting 22527" in various places in .htaccess and it always caused a 500 error.  
  > **username_2**: Note that php_admin_value can be used only in Apache config files (e.g. httpd.conf) and not in .htaccess. In .htaccess, use php_value instead. https://www.php.net/manual/en/configuration.changes.php  
  
  ---
  
  