Log responses from asynchronous api commands

This is mainly useful so that we can see the job ids in the logs
whenever the job is created via the API.
This commit is contained in:
Nathan Johnson 2016-04-27 14:49:50 -05:00
parent 5c1ad900a2
commit 7778e24bf7

View File

@ -686,14 +686,21 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
s_logger.warn(errorMsg);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, errorMsg);
}
final String response;
if (objectId != null) {
final String objUuid = (objectUuid == null) ? objectId.toString() : objectUuid;
return getBaseAsyncCreateResponse(jobId, (BaseAsyncCreateCmd)asyncCmd, objUuid);
response = getBaseAsyncCreateResponse(jobId, (BaseAsyncCreateCmd)asyncCmd, objUuid);
} else {
SerializationContext.current().setUuidTranslation(true);
return getBaseAsyncResponse(jobId, asyncCmd);
response = getBaseAsyncResponse(jobId, asyncCmd);
}
// Always log response for async for now, I don't think any sensitive data will be in here.
// It might be nice to send this through scrubbing similar to how
// ApiResponseSerializer.toSerializedStringWithSecureLogs works. For now, this gets jobid's
// in the api logs.
log.append(response);
return response;
} else {
dispatcher.dispatch(cmdObj, params, false);