From 88b317f7fdb86cf0cb6b8e1e78b56bc6541265fe Mon Sep 17 00:00:00 2001 From: Edison Su Date: Wed, 1 Aug 2012 15:26:26 -0700 Subject: [PATCH] Do not log null lines in agent logfile --- agent/src/com/cloud/agent/Agent.java | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/agent/src/com/cloud/agent/Agent.java b/agent/src/com/cloud/agent/Agent.java index babf0b396d4..6db97aa9245 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;