Share icon
watchdog d7

hey, For many purpose we have to print the array or object while making a custom modules or debuging any old module, we have to print the array or object to see the values are fine or not, drupal provide a way to see those using watchdog, But how we print array or object in watchdog function, Answer is below.

watchdog("any_word_you_like", '<pre>' . print_r( $your_object_variable, true) . '</pre>');

Now, execute your function or page whenever you right it.

Then go to - https://yourdomian/admin/reports/dblog

Then go to - https://yourdomian/admin/reports/dblog

Note - Make sure module "Database logging (dblog)" is on then only you can see the above page.


Please Comment your thoughts and feedback below and add something if you found good in anywhere to help others

Hit a like Button If you like the Post.

Many Thanks

Comments

Profile picture for user Duan Camargo
fredricdore8712 (not verified)
Tue, 11/02/2021 - 17:03
Profile picture for user Duan Camargo
alfieokeefe5893 (not verified)
Tue, 11/02/2021 - 17:27
Profile picture for user Duan Camargo
xbhfrederic092920 (not verified)
Tue, 11/02/2021 - 18:04
Profile picture for user Duan Camargo
mohamed.halmey… (not verified)
Thu, 12/30/2021 - 05:31

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.