Import 'url' module correctly, move exception logger

Fix breakage on setting providerBackendIP, move logging earlier
to catch more errors

Change-Id: I73f3fbdd2255b7092add8beaa2fa2c0ad96a5c09