Do not log null lines in agent logfile

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

Branch: refs/heads/vpc
Commit: 88b317f7fdb86cf0cb6b8e1e78b56bc6541265fe
Parents: ef9dd42
Author: Edison Su <[email protected]>
Authored: Wed Aug 1 15:26:26 2012 -0700
Committer: Edison Su <[email protected]>
Committed: Wed Aug 1 15:26:41 2012 -0700

----------------------------------------------------------------------
 agent/src/com/cloud/agent/Agent.java |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/88b317f7/agent/src/com/cloud/agent/Agent.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/Agent.java 
b/agent/src/com/cloud/agent/Agent.java
index babf0b3..6db97aa 100755
--- a/agent/src/com/cloud/agent/Agent.java
+++ b/agent/src/com/cloud/agent/Agent.java
@@ -466,20 +466,17 @@ public class Agent implements HandlerFactory, 
IAgentControl {
                 final Command cmd = cmds[i];
                 Answer answer;
                 try {
-                    if (s_logger.isDebugEnabled()) {
-                        // this is a hack to make sure we do NOT log the ssh 
keys
-                        if ((cmd instanceof ModifySshKeysCommand)) {
-                            s_logger.debug("Received the request for command: 
ModifySshKeysCommand");
-                        } else {
-                            if (!requestLogged) // ensures request is logged 
only once per method call
-                            {
-                                s_logger.debug("Request:" + 
request.toString());
-                                requestLogged = true;
-                            }
-                        }
-
-                        s_logger.debug("Processing command: " + 
cmd.toString());
-                    }
+                       if (s_logger.isDebugEnabled()) {
+                               if (!requestLogged) // ensures request is 
logged only once per method call
+                               {
+                                       String requestMsg = request.toString();
+                                       if (requestMsg != null) {
+                                               s_logger.debug("Request:" + 
requestMsg);
+                                       }
+                                       requestLogged = true;
+                               }
+                               s_logger.debug("Processing command: " + 
cmd.toString());
+                       }
 
                     if (cmd instanceof CronCommand) {
                         final CronCommand watch = (CronCommand) cmd;

Reply via email to