Do not log null lines in agent logfile

This commit is contained in:
Edison Su 2012-08-01 15:26:26 -07:00
parent ef9dd4210e
commit 88b317f7fd
1 changed files with 11 additions and 14 deletions

View File

@ -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;