public Object onCall(MuleEventContext context) throws Exception {
final MuleMessage mmsg = context.getMessage();
if (!(mmsg.getPayload() instanceof JsonServiceRequest))
return mmsg;
final JsonServiceRequest req = (JsonServiceRequest) mmsg.getPayload();
final String logReqInfo = String.format("ns: %s, service: %s, reqId: %s, sessionId: %s, userId: %s",
req.getNamespace(), req.getService(), req.getReqId(), req.getSessionId(), req.getUserId());
boolean logArgs = !this.servicesToNotLogArgs.contains(req.getNamespace() +";" +req.getService());
if (logArgs) {
if (maxPayloadLengthToLog < 0 || req.getServiceArgsJson().length() <= maxPayloadLengthToLog) {
logger.info(String.format("REQUEST: %s, args: %s",
logReqInfo, req.getServiceArgsJson()));
} else {
if (logger.isDebugEnabled()) {
logger.debug(String.format("REQUEST: %s, args: %s",
logReqInfo, req.getServiceArgsJson()));
} else {
int argsLen = req.getServiceArgsJson().length();
String chunck = req.getServiceArgsJson().substring(0, maxPayloadLengthToLog);
logger.info(String.format("REQUEST: %s, args: %s... %d chars (truncated - full args in debug level)",
logReqInfo, chunck, argsLen));
}
}
} else {