Author: jleroux
Date: Sat Apr  6 10:58:20 2013
New Revision: 1465223

URL: http://svn.apache.org/r1465223
Log:
Adds again the possibility to use the previous way about detecting slow 
services in logs.
Now it uses properties for the 2 Thresholds
0 to get the same behaviour as Adrian's last commit
1000 to get almost the same behaviour than before Adrian's last commit. But 
with no distinctions with slow and very slow services and a higher level for 
slow services. This value makes sense for instance for web services (SOAP, RMI, 
REST) served by external systems.
The properties can be used to set as desired. I believe it's no confusing OOTB 
and still flexible enough.

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

Modified: ofbiz/trunk/framework/service/config/service.properties
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/config/service.properties?rev=1465223&r1=1465222&r2=1465223&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/config/service.properties (original)
+++ ofbiz/trunk/framework/service/config/service.properties Sat Apr  6 10:58:20 
2013
@@ -21,3 +21,7 @@
 remotedispatcher.exportall=false
 # complete answer from SOAP WSDL or only brief message "Problem processing the 
service" for security reason
 secureSoapAnswer=true
+# By default shows all services durations in logs by using a 0 ms value
+showServiceDurationThreshold=0
+# By default shows/marks slow services in logs by using a 1000 ms value
+showSlowServiceThreshold=1000

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=1465223&r1=1465222&r2=1465223&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java 
(original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java 
Sat Apr  6 10:58:20 2013
@@ -31,6 +31,7 @@ import org.ofbiz.base.config.GenericConf
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralRuntimeException;
 import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilTimer;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
@@ -571,8 +572,13 @@ public class ServiceDispatcher {
         rs.setEndStamp();
 
         long timeToRun = System.currentTimeMillis() - serviceStartTime;
-        if (Debug.timingOn()) {
+        long showServiceDurationThreshold = 
UtilProperties.getPropertyAsLong("service", "showServiceDurationThreshold", 0);
+        long showSlowServiceThreshold = 
UtilProperties.getPropertyAsLong("service", "showSlowServiceThreshold", 1000);
+                
+        if (Debug.timingOn() && timeToRun > showServiceDurationThreshold) {
             Debug.logTiming("Sync service [" + localName + "/" + 
modelService.name + "] finished in [" + timeToRun + "] milliseconds", module);
+        } else if (Debug.infoOn() && timeToRun > showSlowServiceThreshold) {
+            Debug.logTiming("Slow sync service execution detected: service [" 
+ localName + "/" + modelService.name + "] finished in [" + timeToRun + "] 
milliseconds", module);
         }
         if ((Debug.verboseOn() || modelService.debug) && timeToRun > 50 && 
!modelService.hideResultInLog) {
             // Sanity check - some service results can be multiple MB in size. 
Limit message size to 10K.


Reply via email to