# HG changeset patch # User Marcin Kuzminski # Date 2016-05-24 21:47:32 # Node ID 2adf7c1f7ca784cbda268dc358e1d307d22d7ef5 # Parent 2880f0df3a7ced14e031cdb717353670e80cff7a authn: don't use formatted_json to log statements. It totally screws up logging formatting, and makes big entries in logs with newlines. diff --git a/rhodecode/authentication/plugins/auth_jasig_cas.py b/rhodecode/authentication/plugins/auth_jasig_cas.py --- a/rhodecode/authentication/plugins/auth_jasig_cas.py +++ b/rhodecode/authentication/plugins/auth_jasig_cas.py @@ -36,7 +36,6 @@ from sqlalchemy.ext.hybrid import hybrid from rhodecode.authentication.base import RhodeCodeExternalAuthPlugin from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase from rhodecode.authentication.routes import AuthnPluginResourceBase -from rhodecode.lib.ext_json import formatted_json from rhodecode.lib.utils2 import safe_unicode from rhodecode.model.db import User @@ -119,17 +118,15 @@ class RhodeCodeAuthPlugin(RhodeCodeExter log.debug('Empty username or password skipping...') return None - log.debug("Jasig CAS settings: \n%s" % (formatted_json(settings))) + log.debug("Jasig CAS settings: %s", settings) params = urllib.urlencode({'username': username, 'password': password}) headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain", "User-Agent": "RhodeCode-auth-%s" % rhodecode.__version__} url = settings["service_url"] - log.debug("Sent Jasig CAS: \n%s" - % (formatted_json({"url": url, - "body": params, - "headers": headers}))) + log.debug("Sent Jasig CAS: \n%s", + {"url": url, "body": params, "headers": headers}) request = urllib2.Request(url, params, headers) try: response = urllib2.urlopen(request) diff --git a/rhodecode/authentication/plugins/auth_ldap.py b/rhodecode/authentication/plugins/auth_ldap.py --- a/rhodecode/authentication/plugins/auth_ldap.py +++ b/rhodecode/authentication/plugins/auth_ldap.py @@ -36,7 +36,6 @@ from rhodecode.authentication.routes imp from rhodecode.lib.exceptions import ( LdapConnectionError, LdapUsernameError, LdapPasswordError, LdapImportError ) -from rhodecode.lib.ext_json import formatted_json from rhodecode.lib.utils2 import safe_unicode, safe_str from rhodecode.model.db import User from rhodecode.model.validators import Missing @@ -435,7 +434,7 @@ class RhodeCodeAuthPlugin(RhodeCodeExter 'extern_name': user_dn, 'extern_type': extern_type, } - log.debug('ldap user: \n%s', formatted_json(user_attrs)) + log.debug('ldap user: %s', user_attrs) log.info('user %s authenticated correctly', user_attrs['username']) return user_attrs diff --git a/rhodecode/authentication/plugins/auth_pam.py b/rhodecode/authentication/plugins/auth_pam.py --- a/rhodecode/authentication/plugins/auth_pam.py +++ b/rhodecode/authentication/plugins/auth_pam.py @@ -35,7 +35,6 @@ from sqlalchemy.ext.hybrid import hybrid from rhodecode.authentication.base import RhodeCodeExternalAuthPlugin from rhodecode.authentication.schema import AuthnPluginSettingsSchemaBase from rhodecode.authentication.routes import AuthnPluginResourceBase -from rhodecode.lib.ext_json import formatted_json log = logging.getLogger(__name__) @@ -151,6 +150,6 @@ class RhodeCodeAuthPlugin(RhodeCodeExter log.warning("Cannot extract additional info for PAM user") pass - log.debug("pamuser: \n%s" % formatted_json(user_attrs)) + log.debug("pamuser: %s", user_attrs) log.info('user %s authenticated correctly' % user_attrs['username']) return user_attrs