Added logging in case of exceptions to the login method.