Private GIT
Clean up db.py and fix logging when database errors occur. Added extra information to help debug database issues.