Improved: Always check if debug verbose is on when using Debug.logVerbose()
(OFBIZ-10052) We discussed on this point: http://markmail.org/message/mplvusuqn7oshl4v and we agreed about better doing a check when using Debug.logVerbose(). I checked there are 300+ cases like that. Since it's an easy S/R This implements it git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1818005 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -2654,7 +2654,7 @@ public class GenericDelegator implements Delegator {
|
||||
Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " does not implement the DistributedCacheClear interface, distributed cache clearing will be disabled", module);
|
||||
}
|
||||
} else {
|
||||
Debug.logVerbose("Distributed Cache Clear System disabled for delegator [" + delegatorFullName + "]", module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Distributed Cache Clear System disabled for delegator [" + delegatorFullName + "]", module);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1227,7 +1227,7 @@ public class GenericEntity implements Map<String, Object>, LocalizedMap<Object>,
|
||||
// Replace each char which is out of the ASCII range with a XML entity
|
||||
String replacement = "&#" + (int) curChar + ";";
|
||||
if (Debug.verboseOn()) {
|
||||
Debug.logVerbose("Entity: " + this.getEntityName() + ", PK: " + this.getPrimaryKey().toString() + " -> char [" + curChar + "] replaced with [" + replacement + "]", module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Entity: " + this.getEntityName() + ", PK: " + this.getPrimaryKey().toString() + " -> char [" + curChar + "] replaced with [" + replacement + "]", module);
|
||||
}
|
||||
value.replace(i, i+1, replacement);
|
||||
}
|
||||
|
||||
+2
-2
@@ -43,9 +43,9 @@ public class DebugManagedDataSource extends ManagedDataSource {
|
||||
if (Debug.verboseOn()) {
|
||||
if (super.getPool() instanceof GenericObjectPool) {
|
||||
GenericObjectPool objectPool = (GenericObjectPool)super.getPool();
|
||||
Debug.logVerbose("Borrowing a connection from the pool; used/idle/total: " + objectPool.getNumActive() + "/" + objectPool.getNumIdle() + "/" + (objectPool.getNumActive() + objectPool.getNumIdle()) + "; min idle/max idle/max total: " + objectPool.getMinIdle() + "/" + objectPool.getMaxIdle() + "/" + objectPool.getMaxTotal(), module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Borrowing a connection from the pool; used/idle/total: " + objectPool.getNumActive() + "/" + objectPool.getNumIdle() + "/" + (objectPool.getNumActive() + objectPool.getNumIdle()) + "; min idle/max idle/max total: " + objectPool.getMinIdle() + "/" + objectPool.getMaxIdle() + "/" + objectPool.getMaxTotal(), module);
|
||||
} else {
|
||||
Debug.logVerbose("Borrowing a connection from the pool; used/idle/total: " + super.getPool().getNumActive() + "/" + super.getPool().getNumIdle() + "/" + (super.getPool().getNumActive() + super.getPool().getNumIdle()), module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Borrowing a connection from the pool; used/idle/total: " + super.getPool().getNumActive() + "/" + super.getPool().getNumIdle() + "/" + (super.getPool().getNumActive() + super.getPool().getNumIdle()), module);
|
||||
}
|
||||
}
|
||||
return super.getConnection();
|
||||
|
||||
@@ -591,7 +591,7 @@ public class GenericDAO {
|
||||
|
||||
if (verboseOn) {
|
||||
// put this inside an if statement so that we don't have to generate the string when not used...
|
||||
Debug.logVerbose("Doing selectListIteratorByCondition with whereEntityCondition: " + whereEntityCondition, module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Doing selectListIteratorByCondition with whereEntityCondition: " + whereEntityCondition, module);
|
||||
}
|
||||
|
||||
// make two ArrayLists of fields, one for fields to select and the other for where clause fields (to find by)
|
||||
@@ -714,7 +714,7 @@ public class GenericDAO {
|
||||
|
||||
if (verboseOn) {
|
||||
// put this inside an if statement so that we don't have to generate the string when not used...
|
||||
Debug.logVerbose("Setting the whereEntityConditionParams: " + whereEntityConditionParams, module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Setting the whereEntityConditionParams: " + whereEntityConditionParams, module);
|
||||
}
|
||||
// set all of the values from the Where EntityCondition
|
||||
for (EntityConditionParam whereEntityConditionParam: whereEntityConditionParams) {
|
||||
@@ -722,7 +722,7 @@ public class GenericDAO {
|
||||
}
|
||||
if (verboseOn) {
|
||||
// put this inside an if statement so that we don't have to generate the string when not used...
|
||||
Debug.logVerbose("Setting the havingEntityConditionParams: " + havingEntityConditionParams, module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Setting the havingEntityConditionParams: " + havingEntityConditionParams, module);
|
||||
}
|
||||
// set all of the values from the Having EntityCondition
|
||||
for (EntityConditionParam havingEntityConditionParam: havingEntityConditionParams) {
|
||||
@@ -963,7 +963,7 @@ public class GenericDAO {
|
||||
|
||||
if (verboseOn) {
|
||||
// put this inside an if statement so that we don't have to generate the string when not used...
|
||||
Debug.logVerbose("Doing selectListIteratorByCondition with whereEntityCondition: " + whereEntityCondition, module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Doing selectListIteratorByCondition with whereEntityCondition: " + whereEntityCondition, module);
|
||||
}
|
||||
|
||||
boolean isGroupBy = false;
|
||||
@@ -1050,7 +1050,7 @@ public class GenericDAO {
|
||||
findOptions.getResultSetConcurrency(), findOptions.getFetchSize(), findOptions.getMaxRows());
|
||||
if (verboseOn) {
|
||||
// put this inside an if statement so that we don't have to generate the string when not used...
|
||||
Debug.logVerbose("Setting the whereEntityConditionParams: " + whereEntityConditionParams, module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Setting the whereEntityConditionParams: " + whereEntityConditionParams, module);
|
||||
}
|
||||
// set all of the values from the Where EntityCondition
|
||||
for (EntityConditionParam whereEntityConditionParam: whereEntityConditionParams) {
|
||||
@@ -1058,7 +1058,7 @@ public class GenericDAO {
|
||||
}
|
||||
if (verboseOn) {
|
||||
// put this inside an if statement so that we don't have to generate the string when not used...
|
||||
Debug.logVerbose("Setting the havingEntityConditionParams: " + havingEntityConditionParams, module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Setting the havingEntityConditionParams: " + havingEntityConditionParams, module);
|
||||
}
|
||||
// set all of the values from the Having EntityCondition
|
||||
for (EntityConditionParam havingEntityConditionParam: havingEntityConditionParams) {
|
||||
|
||||
@@ -1027,7 +1027,7 @@ public class DatabaseUtil {
|
||||
private AbstractCountingCallable createPrimaryKeyFetcher(final DatabaseMetaData dbData, final String lookupSchemaName, final boolean needsUpperCase, final Map<String, Map<String, ColumnCheckInfo>> colInfo, final Collection<String> messages, final String curTable) {
|
||||
return new AbstractCountingCallable(null, null) {
|
||||
public AbstractCountingCallable call() throws Exception {
|
||||
Debug.logVerbose("Fetching primary keys for " + curTable, module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Fetching primary keys for " + curTable, module);
|
||||
ResultSet rsPks = dbData.getPrimaryKeys(null, lookupSchemaName, curTable);
|
||||
count = checkPrimaryKeyInfo(rsPks, lookupSchemaName, needsUpperCase, colInfo, messages);
|
||||
return this;
|
||||
|
||||
@@ -281,15 +281,15 @@ public class SQLProcessor implements AutoCloseable {
|
||||
Debug.logError(e, "Problems getting the connection's isolation level", module);
|
||||
}
|
||||
if (isoLevel == Connection.TRANSACTION_NONE) {
|
||||
Debug.logVerbose("Transaction isolation level set to 'None'.", module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Transaction isolation level set to 'None'.", module);
|
||||
} else if (isoLevel == Connection.TRANSACTION_READ_COMMITTED) {
|
||||
Debug.logVerbose("Transaction isolation level set to 'ReadCommited'.", module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Transaction isolation level set to 'ReadCommited'.", module);
|
||||
} else if (isoLevel == Connection.TRANSACTION_READ_UNCOMMITTED) {
|
||||
Debug.logVerbose("Transaction isolation level set to 'ReadUncommitted'.", module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Transaction isolation level set to 'ReadUncommitted'.", module);
|
||||
} else if (isoLevel == Connection.TRANSACTION_REPEATABLE_READ) {
|
||||
Debug.logVerbose("Transaction isolation level set to 'RepeatableRead'.", module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Transaction isolation level set to 'RepeatableRead'.", module);
|
||||
} else if (isoLevel == Connection.TRANSACTION_SERIALIZABLE) {
|
||||
Debug.logVerbose("Transaction isolation level set to 'Serializable'.", module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Transaction isolation level set to 'Serializable'.", module);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -180,10 +180,10 @@ public class ModelReader implements Serializable {
|
||||
// utilTimer.timerString(" After entityCache.put -- " + i + " --");
|
||||
if (isEntity) {
|
||||
if (Debug.verboseOn())
|
||||
Debug.logVerbose("-- [Entity]: #" + i + ": " + entityName, module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("-- [Entity]: #" + i + ": " + entityName, module);
|
||||
} else {
|
||||
if (Debug.verboseOn())
|
||||
Debug.logVerbose("-- [ViewEntity]: #" + i + ": " + entityName, module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("-- [ViewEntity]: #" + i + ": " + entityName, module);
|
||||
}
|
||||
} else {
|
||||
Debug.logWarning("-- -- ENTITYGEN ERROR:getModelEntity: Could not create " +
|
||||
|
||||
+1
-1
@@ -179,7 +179,7 @@ public class JNDITransactionFactory implements TransactionFactory {
|
||||
|
||||
if (ds != null) {
|
||||
if (Debug.verboseOn())
|
||||
Debug.logVerbose("Got a Datasource object.", module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Got a Datasource object.", module);
|
||||
dsCache.putIfAbsent(jndiName, ds);
|
||||
ds = dsCache.get(jndiName);
|
||||
Connection con;
|
||||
|
||||
+8
-8
@@ -122,11 +122,11 @@ public final class TransactionUtil implements Status {
|
||||
try {
|
||||
int currentStatus = ut.getStatus();
|
||||
if (Debug.verboseOn()) {
|
||||
Debug.logVerbose("Current status : " + getTransactionStateString(currentStatus), module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Current status : " + getTransactionStateString(currentStatus), module);
|
||||
}
|
||||
if (currentStatus == Status.STATUS_ACTIVE) {
|
||||
if (Debug.verboseOn()) {
|
||||
Debug.logVerbose("Active transaction in place, so no transaction begun", module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Active transaction in place, so no transaction begun", module);
|
||||
}
|
||||
return false;
|
||||
} else if (currentStatus == Status.STATUS_MARKED_ROLLBACK) {
|
||||
@@ -182,14 +182,14 @@ public final class TransactionUtil implements Status {
|
||||
if (timeout > 0) {
|
||||
ut.setTransactionTimeout(timeout);
|
||||
if (Debug.verboseOn()) {
|
||||
Debug.logVerbose("Set transaction timeout to : " + timeout + " seconds", module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Set transaction timeout to : " + timeout + " seconds", module);
|
||||
}
|
||||
}
|
||||
|
||||
// begin the transaction
|
||||
ut.begin();
|
||||
if (Debug.verboseOn()) {
|
||||
Debug.logVerbose("Transaction begun", module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Transaction begun", module);
|
||||
}
|
||||
|
||||
// reset the timeout to the default
|
||||
@@ -243,7 +243,7 @@ public final class TransactionUtil implements Status {
|
||||
if (ut != null) {
|
||||
try {
|
||||
int status = ut.getStatus();
|
||||
Debug.logVerbose("Current status : " + getTransactionStateString(status), module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Current status : " + getTransactionStateString(status), module);
|
||||
|
||||
if (status != STATUS_NO_TRANSACTION && status != STATUS_COMMITTING && status != STATUS_COMMITTED && status != STATUS_ROLLING_BACK && status != STATUS_ROLLEDBACK) {
|
||||
ut.commit();
|
||||
@@ -254,7 +254,7 @@ public final class TransactionUtil implements Status {
|
||||
clearTransactionBeginStack();
|
||||
clearSetRollbackOnlyCause();
|
||||
|
||||
Debug.logVerbose("Transaction committed", module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Transaction committed", module);
|
||||
} else {
|
||||
Debug.logWarning("Not committing transaction, status is " + getStatusString(), module);
|
||||
}
|
||||
@@ -315,7 +315,7 @@ public final class TransactionUtil implements Status {
|
||||
if (ut != null) {
|
||||
try {
|
||||
int status = ut.getStatus();
|
||||
Debug.logVerbose("Current status : " + getTransactionStateString(status), module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Current status : " + getTransactionStateString(status), module);
|
||||
|
||||
if (status != STATUS_NO_TRANSACTION) {
|
||||
//if (Debug.infoOn()) Thread.dumpStack();
|
||||
@@ -353,7 +353,7 @@ public final class TransactionUtil implements Status {
|
||||
if (ut != null) {
|
||||
try {
|
||||
int status = ut.getStatus();
|
||||
Debug.logVerbose("Current code : " + getTransactionStateString(status), module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Current code : " + getTransactionStateString(status), module);
|
||||
|
||||
if (status != STATUS_NO_TRANSACTION) {
|
||||
if (status != STATUS_MARKED_ROLLBACK) {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class EntityDataAssert {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Debug.logVerbose("Loading XML Resource: " + dataUrl.toExternalForm(), module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Loading XML Resource: " + dataUrl.toExternalForm(), module);
|
||||
|
||||
try {
|
||||
for (GenericValue checkValue: delegator.readXmlDocument(dataUrl)) {
|
||||
|
||||
@@ -247,7 +247,7 @@ public class EntityDataLoader {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Debug.logVerbose("[loadData] Loading XML Resource: \"" + dataUrl.toExternalForm() + "\"", module);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("[loadData] Loading XML Resource: \"" + dataUrl.toExternalForm() + "\"", module);
|
||||
|
||||
try {
|
||||
/* The OLD way
|
||||
|
||||
@@ -251,7 +251,7 @@ public class EntitySaxReader extends DefaultHandler {
|
||||
}
|
||||
Debug.logImportant("Finished " + numberRead + " values from " + docDescription, module);
|
||||
if (Debug.verboseOn()) {
|
||||
Debug.logVerbose(" Detail created : " + numberCreated + ", skipped : " + numberSkipped +
|
||||
if (Debug.verboseOn()) Debug.logVerbose(" Detail created : " + numberCreated + ", skipped : " + numberSkipped +
|
||||
", updated : " + numberUpdated + ", replaced : " + numberReplaced +
|
||||
", deleted : " + numberDeleted, module);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user