Small fixup for ServiceDispatcher.java - truncate log messages longer than 10K. Some service results can be multiple MB in size, resulting in huge log entries (4 MB in entity reference page).

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1095032 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian Crum
2011-04-19 11:20:39 +00:00
parent 79a144483d
commit b722da2a04
@@ -596,9 +596,19 @@ public class ServiceDispatcher {
long timeToRun = System.currentTimeMillis() - serviceStartTime;
if (Debug.timingOn() && timeToRun > 50) {
Debug.logTiming("Sync service [" + localName + "/" + modelService.name + "] finished in [" + timeToRun + "] milliseconds with response [" + result.toString() + "]", module);
} else if (timeToRun > 200) {
Debug.logInfo("Sync service [" + localName + "/" + modelService.name + "] finished in [" + timeToRun + "] milliseconds with response [" + result.toString() + "]", module);
// Sanity check - some service results can be multiple MB in size. Limit message size to 10K.
String resultStr = result.toString();
if (resultStr.length() > 10240) {
resultStr = resultStr.substring(0, 10226) + "...[truncated]";
}
Debug.logTiming("Sync service [" + localName + "/" + modelService.name + "] finished in [" + timeToRun + "] milliseconds with response [" + resultStr + "]", module);
} else if (timeToRun > 200 && Debug.infoOn()) {
// Sanity check - some service results can be multiple MB in size. Limit message size to 10K.
String resultStr = result.toString();
if (resultStr.length() > 10240) {
resultStr = resultStr.substring(0, 10226) + "...[truncated]";
}
Debug.logInfo("Sync service [" + localName + "/" + modelService.name + "] finished in [" + timeToRun + "] milliseconds with response [" + resultStr + "]", module);
}
return result;