Author: michiel
Date: 2009-09-10 01:06:28 +0200 (Thu, 10 Sep 2009)
New Revision: 38546

Modified:
   
mmbase/trunk/core/src/main/java/org/mmbase/storage/implementation/database/DatabaseStorageManagerFactory.java
Log:
made the 'logQuery' return wether it logged or not, which can be used to take 
other actions then. Like e.g. log also the values in case of an update or insert

Modified: 
mmbase/trunk/core/src/main/java/org/mmbase/storage/implementation/database/DatabaseStorageManagerFactory.java
===================================================================
--- 
mmbase/trunk/core/src/main/java/org/mmbase/storage/implementation/database/DatabaseStorageManagerFactory.java
       2009-09-09 23:05:20 UTC (rev 38545)
+++ 
mmbase/trunk/core/src/main/java/org/mmbase/storage/implementation/database/DatabaseStorageManagerFactory.java
       2009-09-09 23:06:28 UTC (rev 38546)
@@ -95,7 +95,13 @@
      */
     protected boolean supportsTransactions = false;
 
+    /**
 
+     * @since MMBase-1.9.2
+     */
+    protected boolean supportsForeignKeys= true;
+
+
     private static final File BASE_PATH_UNSET = new File("UNSET");
     /**
      * Used by #getBinaryFileBasePath
@@ -332,6 +338,7 @@
             // First, determine the database name from the parameter set in 
mmbaseroot
             String databaseName = mmbase.getInitParameter("database");
             if (databaseName != null && ! "".equals(databaseName)) {
+                log.info("No database specified, using lookup.xml");
                 // if databasename is specified, attempt to use the database 
resource of that name
                 if (databaseName.endsWith(".xml")) {
                     databaseResourcePath = databaseName;
@@ -521,9 +528,10 @@
     }
 
     /**
+     * @return whether logged
      * @since MMBase-1.9.1
      */
-    protected void logQuery(String query, long duration) {
+    protected boolean logQuery(String query, long duration) {
         count++;
         Logger qlog = getLogger(query);
         Logger slog = getStackTraceLogger(query);
@@ -534,6 +542,7 @@
             if (slog.isTraceEnabled()) {
                 slog.trace("trace for #" + count, getTraceException());
             }
+            return qlog.isTraceEnabled();
         } else if (duration < serviceDuration) {
             if (qlog.isDebugEnabled()) {
                 qlog.debug(getLogSqlMessage(query, count, duration));
@@ -541,6 +550,7 @@
             if (slog.isDebugEnabled()) {
                 slog.debug("trace for #" + count, getTraceException());
             }
+            return qlog.isDebugEnabled();
         } else if (duration < infoDuration) {
             if (qlog.isServiceEnabled()) {
                 qlog.service(getLogSqlMessage(query, count, duration));
@@ -548,18 +558,23 @@
             if (slog.isServiceEnabled()) {
                 slog.service("trace for #" + count, getTraceException());
             }
+            return qlog.isServiceEnabled();
         } else if (duration < warnDuration) {
             qlog.info(getLogSqlMessage(query, count, duration));
             slog.info("trace for #" + count, getTraceException());
+            return qlog.isEnabledFor(Level.INFO);
         } else if (duration < errorDuration) {
             qlog.warn(getLogSqlMessage(query, count, duration));
             slog.warn("trace for #" + count, getTraceException());
+            return qlog.isEnabledFor(Level.WARN);
         } else if (duration < fatalDuration) {
             qlog.error(getLogSqlMessage(query, count, duration));
             slog.error("trace for #" + count, getTraceException());
+            return qlog.isEnabledFor(Level.ERROR);
         } else {
             qlog.fatal(getLogSqlMessage(query, count, duration));
             slog.fatal("trace for #" + count, getTraceException());
+            return qlog.isEnabledFor(Level.FATAL);
         }
     }
 

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to