Many a times for debugging the codes which are running in background it becomes necessary to print data in logs. Follow the below steps for printing data in watchdog
- Enable dblog module in admin/modules page (if it is not enabled)
- Add the below code in the background function
watchdog("custom_log", "<pre>" . print_r( $my_data, true) . "</pre>");
- Go to admin/reports/dblog to view the data you can filter the content in log page with "custom_log".
Hope this helps!