diff options
author | Petr Viktorin <pviktori@redhat.com> | 2013-04-17 12:19:15 +0200 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2013-11-26 16:59:59 +0100 |
commit | 73b8047b2298d347475a5c8d9f1853052ddced57 (patch) | |
tree | 348c12293db26b90d8a42cb560ef66cb479b18fd /ipaserver/rpcserver.py | |
parent | 6839d8334ead3613068c5a031b32d7dd34219a9f (diff) | |
download | freeipa-73b8047b2298d347475a5c8d9f1853052ddced57.tar.gz freeipa-73b8047b2298d347475a5c8d9f1853052ddced57.tar.xz freeipa-73b8047b2298d347475a5c8d9f1853052ddced57.zip |
Add server/protocol type to rpcserver logs
Add the server class name, such as [xmlserver] or [jsonserver_kerb] to
the server logs. This will allow easier debugging of problems specific
to a protocol or server class.
Diffstat (limited to 'ipaserver/rpcserver.py')
-rw-r--r-- | ipaserver/rpcserver.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py index e4be51d64..a37d3cd0f 100644 --- a/ipaserver/rpcserver.py +++ b/ipaserver/rpcserver.py @@ -308,6 +308,7 @@ class WSGIExecutioner(Executioner): args = () options = {} + e = None if not 'HTTP_REFERER' in environ: return self.marshal(result, RefererError(referer='missing'), _id) if not environ['HTTP_REFERER'].startswith('https://%s/ipa' % self.api.env.host) and not self.env.in_tree: @@ -342,6 +343,8 @@ class WSGIExecutioner(Executioner): error = InternalError() finally: os.environ['LANG'] = lang + + principal = getattr(context, 'principal', 'UNKNOWN') if name and name in self.Command: try: params = self.Command[name].args_options_2_params(*args, **options) @@ -351,13 +354,23 @@ class WSGIExecutioner(Executioner): ) # get at least some context of what is going on params = options - principal = getattr(context, 'principal', 'UNKNOWN') if error: - self.info('%s: %s(%s): %s', principal, name, ', '.join(self.Command[name]._repr_iter(**params)), e.__class__.__name__) + result_string = type(e).__name__ else: - self.info('%s: %s(%s): SUCCESS', principal, name, ', '.join(self.Command[name]._repr_iter(**params))) + result_string = 'SUCCESS' + self.info('[%s] %s: %s(%s): %s', + type(self).__name__, + principal, + name, + ', '.join(self.Command[name]._repr_iter(**params)), + result_string) else: - self.info('%s: %s', context.principal, e.__class__.__name__) + self.info('[%s] %s: %s: %s', + type(self).__name__, + principal, + name, + type(e).__name__) + return self.marshal(result, error, _id) def simple_unmarshal(self, environ): |