You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2012/06/01 10:12:46 UTC

svn commit: r1345005 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java

Author: jacopoc
Date: Fri Jun  1 08:12:46 2012
New Revision: 1345005

URL: http://svn.apache.org/viewvc?rev=1345005&view=rev
Log:
Improved error messages that notify when a service's time to run was over some given threasholds.
Refactored code (simplified and removed duplicated block) that logs, in these cases, the output of the service; now the service output is only printed in verbose mode (of course if the other conditions hold true).


Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?rev=1345005&r1=1345004&r2=1345005&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Fri Jun  1 08:12:46 2012
@@ -587,30 +587,18 @@ public class ServiceDispatcher {
 
         long timeToRun = System.currentTimeMillis() - serviceStartTime;
         if (Debug.timingOn() && timeToRun > 50) {
+            Debug.logTiming("Slow sync service execution detected: service [" + localName + "/" + modelService.name + "] finished in [" + timeToRun + "] milliseconds", module);
+        } else if (Debug.infoOn() && timeToRun > 200) {
+            Debug.logInfo("Very slow sync service execution detected: service [" + localName + "/" + modelService.name + "] finished in [" + timeToRun + "] milliseconds", module);
+        }
+        if (Debug.verboseOn() && timeToRun > 50 && !modelService.hideResultInLog) {
             // 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]";
             }
-            if (!modelService.hideResultInLog) {
-                Debug.logTiming("Sync service [" + localName + "/" + modelService.name + "] finished in [" + timeToRun + "] milliseconds with response [" + resultStr + "]", module);
-            } else {
-                Debug.logTiming("Sync service [" + localName + "/" + modelService.name + "] finished in [" + timeToRun + "] milliseconds", 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]";
-            }
-            if (!modelService.hideResultInLog) {
-                Debug.logInfo("Sync service [" + localName + "/" + modelService.name + "] finished in [" + timeToRun + "] milliseconds with response [" + resultStr + "]", module);
-            } else {
-                Debug.logInfo("Sync service [" + localName + "/" + modelService.name + "] finished in [" + timeToRun + "] milliseconds", module);
-                
-            }
+            Debug.logVerbose("Sync service [" + localName + "/" + modelService.name + "] finished with response [" + resultStr + "]", module);
         }
-
         return result;
     }