You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sw...@apache.org on 2016/04/28 22:01:28 UTC

[6/9] git commit: updated refs/heads/master to 1f53adb

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.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7778e24b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7778e24b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7778e24b

Branch: refs/heads/master
Commit: 7778e24bf7bb7bd2c1a19fde5fb711b8d8086446
Parents: 5c1ad90
Author: Nathan Johnson <nj...@ena.com>
Authored: Wed Apr 27 14:49:50 2016 -0500
Committer: Nathan Johnson <nj...@ena.com>
Committed: Wed Apr 27 19:43:57 2016 -0500

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiServer.java | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7778e24b/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index f76b851..6ec2f18 100644
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -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);