Skip to content

Commit a81d227

Browse files
chipchildersjzb
authored andcommitted
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
1 parent d5c9ad0 commit a81d227

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎server/src/com/cloud/api/ApiServlet.java‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import com.cloud.user.Account;
3737
import com.cloud.user.AccountService;
3838
import com.cloud.user.UserContext;
39+
import com.cloud.utils.StringUtils;
3940
import com.cloud.utils.component.ComponentLocator;
4041
import com.cloud.utils.exception.CloudRuntimeException;
4142

@@ -122,6 +123,13 @@ private void processRequest(HttpServletRequest req, HttpServletResponse resp) {
122123
//
123124
utf8Fixup(req, params);
124125

126+
// logging the request start and end in management log for easy debugging
127+
String reqStr = "";
128+
if (s_logger.isDebugEnabled()) {
129+
reqStr = auditTrailSb.toString() + " " + req.getQueryString();
130+
s_logger.debug("===START=== " + StringUtils.cleanString(reqStr));
131+
}
132+
125133
try {
126134
HttpSession session = req.getSession(false);
127135
Object[] responseTypeParam = params.get("response");
@@ -335,6 +343,11 @@ private void processRequest(HttpServletRequest req, HttpServletResponse resp) {
335343
}
336344
} finally {
337345
s_accessLogger.info(auditTrailSb.toString());
346+
347+
if (s_logger.isDebugEnabled()) {
348+
s_logger.debug("===END=== " + StringUtils.cleanString(reqStr));
349+
}
350+
338351
// cleanup user context to prevent from being peeked in other request context
339352
UserContext.unregisterContext();
340353
}

0 commit comments

Comments
 (0)