ApiServer: Log a better message if api access fails and debug it

Signed-off-by: Rohit Yadav <[email protected]>


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

Branch: refs/heads/api_limit
Commit: e63e35250876a4f985a707ac52bdef34465a2470
Parents: 345c179
Author: Rohit Yadav <[email protected]>
Authored: Thu Jan 10 16:08:16 2013 -0800
Committer: Rohit Yadav <[email protected]>
Committed: Thu Jan 10 16:08:16 2013 -0800

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiServer.java |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e63e3525/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 7387125..be3c087 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -552,14 +552,14 @@ public class ApiServer implements HttpRequestHandler {
             if (userId != null) {
                User user = ApiDBUtils.findUserById(userId);
                 if (!isCommandAvailable(user, commandName)) {
-                    s_logger.warn("The given command:" + commandName + " does 
not exist or it is not available for user");
+                    s_logger.debug("The given command:" + commandName + " does 
not exist or it is not available for user with id:" + userId);
                     throw new 
ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, "The given command does 
not exist or it is not available for user");
                 }
                 return true;
             } else {
                 // check against every available command to see if the command 
exists or not
                 if (!isCommandAvailable(null, commandName) && 
!commandName.equals("login") && !commandName.equals("logout")) {
-                    s_logger.warn("The given command:" + commandName + " does 
not exist or it is not available for user");
+                    s_logger.debug("The given command:" + commandName + " does 
not exist or it is not available for user with id:" + userId);
                     throw new 
ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, "The given command does 
not exist or it is not available for user");
                 }
             }
@@ -653,8 +653,8 @@ public class ApiServer implements HttpRequestHandler {
             UserContext.updateContext(user.getId(), account, null);
 
             if (!isCommandAvailable(user, commandName)) {
-                s_logger.warn("The given command:" + commandName + " does not 
exist or it is not available for user");
-                throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, 
"The given command:" + commandName + " does not exist or it is not available 
for user");
+                s_logger.debug("The given command:" + commandName + " does not 
exist or it is not available for user");
+                throw new ServerApiException(BaseCmd.UNSUPPORTED_ACTION_ERROR, 
"The given command:" + commandName + " does not exist or it is not available 
for user with id:" + userId);
             }
 
             // verify secret key exists

Reply via email to