Add default success/failure output logging.

Request logging on the server only happened if you added verbose=True
or debug=True to the IPA config file. We should log the basics at
least: who, what, result.

Move a lot of entries from info to debug logging as well.

Related to ticket 873
This commit is contained in:
Rob Crittenden
2011-02-11 17:24:20 -05:00
parent 1315ba19d2
commit 29706fb13b
7 changed files with 24 additions and 16 deletions

View File

@@ -166,7 +166,7 @@ class session(Executioner):
raise StandardError('%s.mount(): cannot replace %r with %r at %r' % (
self.name, self.__apps[key], app, key)
)
self.info('Mounting %r at %r', app, key)
self.debug('Mounting %r at %r', app, key)
self.__apps[key] = app
@@ -218,6 +218,11 @@ class WSGIExecutioner(Executioner):
error = InternalError()
finally:
os.environ['LANG']=lang
params = self.Command[name].args_options_2_params(*args, **options)
if error:
self.info('%s: %s(%s): %s', context.principal, name, ', '.join(self.Command[name]._repr_iter(**params)), e.__class__.__name__)
else:
self.info('%s: %s(%s): SUCCESS', context.principal, name, ', '.join(self.Command[name]._repr_iter(**params)))
return self.marshal(result, error, _id)
def simple_unmarshal(self, environ):
@@ -288,7 +293,7 @@ class xmlserver(WSGIExecutioner):
(args, options) = params_2_args_options(params)
response = (self.execute(name, *args, **options),)
except PublicError, e:
self.info('response: %s: %s', e.__class__.__name__, str(e))
self.debug('response: %s: %s', e.__class__.__name__, str(e))
response = Fault(e.errno, e.strerror)
return xml_dumps(response, methodresponse=True)
@@ -299,11 +304,11 @@ class xmlserver(WSGIExecutioner):
def marshal(self, result, error, _id=None):
if error:
self.info('response: %s: %s', error.__class__.__name__, str(error))
self.debug('response: %s: %s', error.__class__.__name__, str(error))
response = Fault(error.errno, error.strerror)
else:
if isinstance(result, dict):
self.info('response: entries returned %d', result.get('count', 1))
self.debug('response: entries returned %d', result.get('count', 1))
response = (result,)
return xml_dumps(response, methodresponse=True)