You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2013/09/17 21:17:49 UTC

svn commit: r1524183 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java

Author: adrianc
Date: Tue Sep 17 19:17:49 2013
New Revision: 1524183

URL: http://svn.apache.org/r1524183
Log:
Minor change to GenericDelegator - Put some logging calls inside if blocks.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=1524183&r1=1524182&r2=1524183&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Tue Sep 17 19:17:49 2013
@@ -783,14 +783,18 @@ public class GenericDelegator implements
                 if (existingValue == null) {
                     throw e;
                 } else {
-                    Debug.logInfo("Error creating entity record with a sequenced value [" + value.getPrimaryKey() + "], trying again about to refresh bank for entity [" + value.getEntityName() + "]", module);
+                    if (Debug.infoOn()) {
+                        Debug.logInfo("Error creating entity record with a sequenced value [" + value.getPrimaryKey() + "], trying again about to refresh bank for entity [" + value.getEntityName() + "]", module);
+                    }
 
                     // found an existing value... was probably a duplicate key, so clean things up and try again
                     this.sequencer.forceBankRefresh(value.getEntityName(), 1);
 
                     value.setNextSeqId();
                     value = helper.create(value);
-                    Debug.logInfo("Successfully created new entity record on retry with a sequenced value [" + value.getPrimaryKey() + "], after getting refreshed bank for entity [" + value.getEntityName() + "]", module);
+                    if (Debug.infoOn()) {
+                        Debug.logInfo("Successfully created new entity record on retry with a sequenced value [" + value.getPrimaryKey() + "], after getting refreshed bank for entity [" + value.getEntityName() + "]", module);
+                    }
 
                     if (testMode) {
                         storeForTestRollback(new TestOperation(OperationType.INSERT, value));
@@ -2255,7 +2259,9 @@ public class GenericDelegator implements
         }
 
         if (primaryKey.getModelEntity().getNeverCache()) {
-            Debug.logWarning("Tried to put a value of the " + value.getEntityName() + " entity in the BY PRIMARY KEY cache but this entity has never-cache set to true, not caching.", module);
+            if (Debug.warningOn()) {
+                Debug.logWarning("Tried to put a value of the " + value.getEntityName() + " entity in the BY PRIMARY KEY cache but this entity has never-cache set to true, not caching.", module);
+            }
             return;
         }
 
@@ -2672,7 +2678,9 @@ public class GenericDelegator implements
                         entity.dangerousSetNoCheckButFast(field, crypto.decrypt(keyName, encValue));
                     } catch (EntityCryptoException e) {
                         // not fatal -- allow returning of the encrypted value
-                        Debug.logWarning(e, "Problem decrypting field [" + entityName + " / " + field.getName() + "]", module);
+                        if (Debug.warningOn()) {
+                            Debug.logWarning(e, "Problem decrypting field [" + entityName + " / " + field.getName() + "]", module);
+                        }
                     }
                 }
             }
@@ -2845,7 +2853,9 @@ public class GenericDelegator implements
         }
         this.testMode = false;
         this.testRollbackInProgress = true;
-        Debug.logInfo("Rolling back " + testOperations.size() + " entity operations", module);
+        if (Debug.infoOn()) {
+            Debug.logInfo("Rolling back " + testOperations.size() + " entity operations", module);
+        }
         while (!this.testOperations.isEmpty()) {
             TestOperation testOperation = this.testOperations.pollLast();
             if (testOperation == null) {