Skip to content

Commit

Permalink
[feature]adding service call duration in log handler.
Browse files Browse the repository at this point in the history
The format of request and response log has been changed to json.
Request log consists of "soap-request" field.
Successful response log consist of "soap-response" and "duration field."
Unsuccessful response log consist of "soap-fault" and "duration" field.
  • Loading branch information
a.ebrahimi committed Jul 1, 2024
1 parent cc718ba commit a2012db
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public boolean handleMessage(SOAPMessageContext messageContext) {
try {
msg.writeTo(logStream);
if (request) {
logParams.put("Soap Request", getBody(logStream));
logParams.put("soap-request", getBody(logStream));
startTimeMillis.set(System.currentTimeMillis());
} else {
logParams.put("Soap Response", getBody(logStream));
logParams.put("soap-response", getBody(logStream));
logParams.put("duration", getDurationLogMessage());
}
logger.info(mapper.writeValueAsString(logParams));
Expand All @@ -76,7 +76,7 @@ public boolean handleFault(SOAPMessageContext c) {
OutputStream logStream = new ByteArrayOutputStream();
msg.writeTo(logStream);
Map<String, String> params = new LinkedHashMap<>();
params.put("Soap Fault", getBody(logStream));
params.put("soap-fault", getBody(logStream));
params.put("duration", getDurationLogMessage());
logger.info(mapper.writeValueAsString(params));
} catch (Exception e) {
Expand Down

0 comments on commit a2012db

Please sign in to comment.