CLOUDSTACK-505: Added string cleaning to the start and end debug

log statements within the API servlet.

Conflicts:
	server/src/com/cloud/api/ApiServlet.java
This commit is contained in:
Chip Childers 2012-12-17 15:13:59 -05:00 committed by Joe Brockmeier
parent d5c9ad0f94
commit a81d227f1f
1 changed files with 13 additions and 0 deletions

View File

@ -36,6 +36,7 @@ import com.cloud.server.ManagementServer;
import com.cloud.user.Account;
import com.cloud.user.AccountService;
import com.cloud.user.UserContext;
import com.cloud.utils.StringUtils;
import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.exception.CloudRuntimeException;
@ -122,6 +123,13 @@ public class ApiServlet extends HttpServlet {
//
utf8Fixup(req, params);
// logging the request start and end in management log for easy debugging
String reqStr = "";
if (s_logger.isDebugEnabled()) {
reqStr = auditTrailSb.toString() + " " + req.getQueryString();
s_logger.debug("===START=== " + StringUtils.cleanString(reqStr));
}
try {
HttpSession session = req.getSession(false);
Object[] responseTypeParam = params.get("response");
@ -335,6 +343,11 @@ public class ApiServlet extends HttpServlet {
}
} finally {
s_accessLogger.info(auditTrailSb.toString());
if (s_logger.isDebugEnabled()) {
s_logger.debug("===END=== " + StringUtils.cleanString(reqStr));
}
// cleanup user context to prevent from being peeked in other request context
UserContext.unregisterContext();
}