Problem/Motivation

The function watchdog_exception() is deprecated, and replaced by \Drupal\Core\Utility\Error::logException()

Steps to reproduce

$ vendor/bin/drupal-check --drupal-root $CI_PROJECT_DIR/$_WEB_ROOT $CI_PROJECT_DIR/$_WEB_ROOT/modules/custom/$CI_PROJECT_NAME

 ------ ----------------------------------------------------------- 
  Line   src/Service/RebuildIpAddressService.php                    
 ------ ----------------------------------------------------------- 
  59     Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
 ------ ----------------------------------------------------------- 
 ------ ----------------------------------------------------------- 
  Line   src/Service/RebuildRouteService.php                        
 ------ ----------------------------------------------------------- 
  64     Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  78     Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  98     Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
 ------ ----------------------------------------------------------- 
 ------ ----------------------------------------------------------- 
  Line   src/Service/TrackerService.php                             
 ------ ----------------------------------------------------------- 
  210    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
 ------ ----------------------------------------------------------- 

 ------ ----------------------------------------------------------- 
  Line   visitors.install                                           
 ------ ----------------------------------------------------------- 
  393    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  551    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  571    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  590    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  609    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  628    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  647    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  666    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  685    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  704    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  723    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  777    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  912    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  926    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  1044   Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  2631   Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
 ------ ----------------------------------------------------------- 
 ------ ----------------------------------------------------------- 
  Line   visitors.module                                            
 ------ ----------------------------------------------------------- 
  69     Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  324    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  374    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  396    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  443    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
  479    Call to deprecated function watchdog_exception():          
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use    
           Use \Drupal\Core\Utility\Error::logException() instead.  
 ------ ----------------------------------------------------------- 
 ------ ---------------------------------------------------------------- 
  Line   visitors_geoip/src/EventSubscriber/GeoIpVisitLogSubscriber.php  
 ------ ---------------------------------------------------------------- 
  86     Call to deprecated function watchdog_exception():               
         in drupal:10.1.0 and is removed from drupal:11.0.0. Use         
           Use \Drupal\Core\Utility\Error::logException() instead.       
 ------ ---------------------------------------------------------------- 

Proposed resolution

Remaining tasks

This cannot be merged until Drupal 9 is End of Life.

User interface changes

API changes

Data model changes

Issue fork visitors-3392006

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bluegeek9 created an issue. See original summary.

shreya_th’s picture

Assigned: Unassigned » shreya_th
shreya_th’s picture

Assigned: shreya_th » Unassigned
Status: Active » Needs review
StatusFileSize
new661 bytes

Hi @bluegeek9,
I have fixed this issue i.e. watchdog_exception() deprecated in RebuildIpAddressService.php. Kindly review the attached patch file.

bluegeek9’s picture

Status: Needs review » Needs work

Hi @Shareya_th,

Here is an example of replacing watchdog_exception() with Error::logException():
https://git.drupalcode.org/project/search_api/-/merge_requests/87/diffs

shreya_th’s picture

Assigned: Unassigned » shreya_th
shreya_th’s picture

Assigned: shreya_th » Unassigned
sarwan_verma’s picture

Assigned: Unassigned » sarwan_verma
sarwan_verma’s picture

StatusFileSize
new10.84 KB

Hi @bluegeek9,
I have fixed this issue watchdog_exception() and also attached patch,
please review and verify.

sarwan_verma’s picture

Assigned: sarwan_verma » Unassigned
Status: Needs work » Needs review

bluegeek9’s picture

Status: Needs review » Postponed

The pull request looks good. I am postponing merging since Drupal 9 will not work with this change. I don't want to drop support for D9 yet.

trackleft2’s picture

Aren't the use statements incorrect?

use \Drupal\Core\Utility\Error;

Should be

use Drupal\Core\Utility\Error;

bluegeek9’s picture

@trackleft2,

You are correct, but you also need to look at the merge request, not the patch(es).

https://git.drupalcode.org/project/visitors/-/merge_requests/104/diffs

bluegeek9’s picture

Status: Postponed » Fixed
//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support to this project makes other volunteer contributions more sustainable.
There are multiple ways to show appreciation for the work contributed to this project including:
  • Triaging issues and adding more context to existing issues.
  • Writing documentation or patches for this project.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

bluegeek9’s picture

This issue was resolved. A new release, 8.x-2.17, will be made soon, May 31st.

This is an excellent opportunity to beta test the dev branch, and report any issues.

Contributors (5)

bluegeek9, roshni27, abhishek_gupta1, sarwan_verma, SandeepSingh199

Changelog

Issues: 32 issues resolved.

Changes since 8.x-2.16:

Bug

Feature

Task