Author: chirino
Date: Wed Sep 23 19:46:21 2009
New Revision: 818224

URL: http://svn.apache.org/viewvc?rev=818224&view=rev
Log:
MQ-2404 : Configurable KahaDBStore verbosity.. 
-Dorg.apache.activemq.store.kahadb.LOG_SLOW_ACCESS_TIME=300 system prop now 
supported.


Modified:
    
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java

Modified: 
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java?rev=818224&r1=818223&r2=818224&view=diff
==============================================================================
--- 
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
 (original)
+++ 
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/store/kahadb/MessageDatabase.java
 Wed Sep 23 19:46:21 2009
@@ -59,12 +59,16 @@
 
 public class MessageDatabase {
 
+    public static final String PROPERTY_LOG_SLOW_ACCESS_TIME = 
"org.apache.activemq.store.kahadb.LOG_SLOW_ACCESS_TIME";
+    public static final int LOG_SLOW_ACCESS_TIME = 
Integer.parseInt(System.getProperty(PROPERTY_LOG_SLOW_ACCESS_TIME, "500"));
+
     private static final Log LOG = LogFactory.getLog(MessageDatabase.class);
     private static final int DATABASE_LOCKED_WAIT_DELAY = 10 * 1000;
 
     public static final int CLOSED_STATE = 1;
     public static final int OPEN_STATE = 2;
 
+
     protected class Metadata {
         protected Page<Metadata> page;
         protected int state;
@@ -566,8 +570,8 @@
                 });
             }
                long end = System.currentTimeMillis();
-               if( end-start > 100 ) { 
-                       LOG.info("KahaDB Cleanup took "+(end-start));
+               if( LOG_SLOW_ACCESS_TIME>0 && end-start > LOG_SLOW_ACCESS_TIME) 
{
+                       LOG.info("Slow KahaDB access: cleanup took 
"+(end-start));
                }
         } catch (IOException e) {
                e.printStackTrace();
@@ -612,8 +616,8 @@
         long start2 = System.currentTimeMillis();
         process(data, location);
        long end = System.currentTimeMillis();
-       if( end-start > 100 ) { 
-               LOG.info("KahaDB long enqueue time: Journal Add Took: 
"+(start2-start)+" ms, Index Update took "+(end-start2)+" ms");
+       if( LOG_SLOW_ACCESS_TIME>0 && end-start > LOG_SLOW_ACCESS_TIME) {
+               LOG.info("Slow KahaDB access: Journal append took: 
"+(start2-start)+" ms, Index update took "+(end-start2)+" ms");
        }
 
         synchronized (indexMutex) {


Reply via email to