Add user_domain_name to logs regarding authentication
The user domain name is useful information when troubleshooting
authentication in OpenStack-installations with multiple domains.
@@ -136,19 +136,15 @@ class Login(django_auth_forms.AuthenticationForm):
password=password,
user_domain_name=domain,
auth_url=region)
- msg = 'Login successful for user "%(username)s", remote address '\
- '%(remote_ip)s.' % {
- 'username': username,
- 'remote_ip': utils.get_client_ip(self.request)
- }
- LOG.info(msg)
+ LOG.info('Login successful for user "%(username)s" using domain '
+ '"%(domain)s", remote address %(remote_ip)s.',
+ {'username': username, 'domain': domain,
+ 'remote_ip': utils.get_client_ip(self.request)})
except exceptions.KeystoneAuthException as exc:
- msg = 'Login failed for user "%(username)s", remote address '\
- '%(remote_ip)s.' % {
- 'username': username,
- 'remote_ip': utils.get_client_ip(self.request)
- }
- LOG.warning(msg)
+ LOG.info('Login failed for user "%(username)s" using domain '
+ '"%(domain)s", remote address %(remote_ip)s.',
+ {'username': username, 'domain': domain,
+ 'remote_ip': utils.get_client_ip(self.request)})
raise forms.ValidationError(exc)
if hasattr(self, 'check_for_test_cookie'): # Dropped in django 1.7
self.check_for_test_cookie()
