pass debug level as parameter
updated logging to always log errors
The active providers were not determined correctly