Adds debug logging

Adds debug logging to API, DB API and workers for gathering
troubleshooting info