diff --git a/org.adempiere.base/src/org/compiere/model/MArchive.java b/org.adempiere.base/src/org/compiere/model/MArchive.java index f5cf47594d..bb847d6d8b 100644 --- a/org.adempiere.base/src/org/compiere/model/MArchive.java +++ b/org.adempiere.base/src/org/compiere/model/MArchive.java @@ -76,7 +76,7 @@ public class MArchive extends X_AD_Archive { if (list.size() == 0) s_log.fine(sql.toString()); else - s_log.finer(sql.toString()); + if (s_log.isLoggable(Level.FINER)) s_log.finer(sql.toString()); // MArchive[] retValue = new MArchive[list.size()]; list.toArray(retValue); diff --git a/org.adempiere.base/src/org/compiere/model/MCost.java b/org.adempiere.base/src/org/compiere/model/MCost.java index 2f2a70d533..61b82fd621 100644 --- a/org.adempiere.base/src/org/compiere/model/MCost.java +++ b/org.adempiere.base/src/org/compiere/model/MCost.java @@ -221,7 +221,7 @@ public class MCost extends X_M_Cost // Standard costs - just Material Costs if (MCostElement.COSTINGMETHOD_StandardCosting.equals(costingMethod)) { - s_log.finer("MaterialCosts = " + materialCost); + if (s_log.isLoggable(Level.FINER)) s_log.finer("MaterialCosts = " + materialCost); return materialCost; } if (MCostElement.COSTINGMETHOD_Fifo.equals(costingMethod) @@ -240,7 +240,7 @@ public class MCost extends X_M_Cost if (costs.signum() == 0) return null; - s_log.finer("Sum Costs = " + costs); + if (s_log.isLoggable(Level.FINER)) s_log.finer("Sum Costs = " + costs); int precision = as.getCostingPrecision(); if (percentage.signum() == 0) // no percentages { @@ -254,7 +254,7 @@ public class MCost extends X_M_Cost costs = costs.add(percentCost); if (costs.scale() > precision) costs = costs.setScale(precision, BigDecimal.ROUND_HALF_UP); - s_log.finer("Sum Costs = " + costs + " (Add=" + percentCost + ")"); + if (s_log.isLoggable(Level.FINER)) s_log.finer("Sum Costs = " + costs + " (Add=" + percentCost + ")"); return costs; } // getCurrentCost @@ -502,7 +502,7 @@ public class MCost extends X_M_Cost if (retValue != null) { - s_log.finer(product.getName() + " = " + retValue); + if (s_log.isLoggable(Level.FINER)) s_log.finer(product.getName() + " = " + retValue); return retValue; } return null; @@ -565,7 +565,7 @@ public class MCost extends X_M_Cost if (retValue != null) { - s_log.finer(product.getName() + " = " + retValue); + if (s_log.isLoggable(Level.FINER)) s_log.finer(product.getName() + " = " + retValue); return retValue; } return null; @@ -617,7 +617,7 @@ public class MCost extends X_M_Cost if (retValue != null) { - s_log.finer(product.getName() + " = " + retValue); + if (s_log.isLoggable(Level.FINER)) s_log.finer(product.getName() + " = " + retValue); return retValue; } return null; @@ -864,7 +864,7 @@ public class MCost extends X_M_Cost BigDecimal matchQty = rs.getBigDecimal(2); if (matchQty == null) { - s_log.finer("Movement=" + movementQty + ", StockQty=" + newStockQty); + if (s_log.isLoggable(Level.FINER)) s_log.finer("Movement=" + movementQty + ", StockQty=" + newStockQty); continue; } // Assumption: everything is matched @@ -884,7 +884,7 @@ public class MCost extends X_M_Cost BigDecimal newAmt = averageCurrent.add(averageIncrease); newAmt = newAmt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP); newAverageAmt = newAmt.divide(newStockQty, as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP); - s_log.finer("Movement=" + movementQty + ", StockQty=" + newStockQty + if (s_log.isLoggable(Level.FINER)) s_log.finer("Movement=" + movementQty + ", StockQty=" + newStockQty + ", Match=" + matchQty + ", Cost=" + cost + ", NewAvg=" + newAverageAmt); } } @@ -900,7 +900,7 @@ public class MCost extends X_M_Cost // if (newAverageAmt != null && newAverageAmt.signum() != 0) { - s_log.finer(product.getName() + " = " + newAverageAmt); + if (s_log.isLoggable(Level.FINER)) s_log.finer(product.getName() + " = " + newAverageAmt); return newAverageAmt; } return null; @@ -958,7 +958,7 @@ public class MCost extends X_M_Cost BigDecimal matchQty = rs.getBigDecimal(2); if (matchQty == null) { - s_log.finer("Movement=" + movementQty + ", StockQty=" + newStockQty); + if (s_log.isLoggable(Level.FINER)) s_log.finer("Movement=" + movementQty + ", StockQty=" + newStockQty); continue; } // Assumption: everything is matched @@ -980,7 +980,7 @@ public class MCost extends X_M_Cost BigDecimal newAmt = averageCurrent.add(averageIncrease); newAmt = newAmt.setScale(as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP); newAverageAmt = newAmt.divide(newStockQty, as.getCostingPrecision(), BigDecimal.ROUND_HALF_UP); - s_log.finer("Movement=" + movementQty + ", StockQty=" + newStockQty + if (s_log.isLoggable(Level.FINER)) s_log.finer("Movement=" + movementQty + ", StockQty=" + newStockQty + ", Match=" + matchQty + ", Cost=" + cost + ", NewAvg=" + newAverageAmt); } } @@ -996,7 +996,7 @@ public class MCost extends X_M_Cost // if (newAverageAmt != null && newAverageAmt.signum() != 0) { - s_log.finer(product.getName() + " = " + newAverageAmt); + if (s_log.isLoggable(Level.FINER)) s_log.finer(product.getName() + " = " + newAverageAmt); return newAverageAmt; } return null; @@ -1082,7 +1082,7 @@ public class MCost extends X_M_Cost QtyCost pp = new QtyCost (movementQty, Env.ZERO); fifo.add(pp); } - s_log.finer("Movement=" + movementQty + ", Size=" + fifo.size()); + if (s_log.isLoggable(Level.FINER)) s_log.finer("Movement=" + movementQty + ", Size=" + fifo.size()); continue; } // Assumption: everything is matched @@ -1117,7 +1117,7 @@ public class MCost extends X_M_Cost QtyCost pp = new QtyCost (movementQty, cost); fifo.add(pp); } - s_log.finer("Movement=" + movementQty + ", Size=" + fifo.size()); + if (s_log.isLoggable(Level.FINER)) s_log.finer("Movement=" + movementQty + ", Size=" + fifo.size()); } } catch (SQLException e) @@ -1135,7 +1135,7 @@ public class MCost extends X_M_Cost return null; } QtyCost pp = (QtyCost)fifo.get(0); - s_log.finer(product.getName() + " = " + pp.Cost); + if (s_log.isLoggable(Level.FINER)) s_log.finer(product.getName() + " = " + pp.Cost); return pp.Cost; } // calculateFiFo @@ -1220,7 +1220,7 @@ public class MCost extends X_M_Cost QtyCost pp = new QtyCost (movementQty, Env.ZERO); lifo.add(pp); } - s_log.finer("Movement=" + movementQty + ", Size=" + lifo.size()); + if (s_log.isLoggable(Level.FINER)) s_log.finer("Movement=" + movementQty + ", Size=" + lifo.size()); continue; } // Assumption: everything is matched @@ -1236,7 +1236,7 @@ public class MCost extends X_M_Cost // QtyCost pp = new QtyCost (movementQty, cost); lifo.add(pp); - s_log.finer("Movement=" + movementQty + ", Size=" + lifo.size()); + if (s_log.isLoggable(Level.FINER)) s_log.finer("Movement=" + movementQty + ", Size=" + lifo.size()); } } catch (SQLException e) @@ -1254,7 +1254,7 @@ public class MCost extends X_M_Cost return null; } QtyCost pp = (QtyCost)lifo.get(lifo.size()-1); - s_log.finer(product.getName() + " = " + pp.Cost); + if (s_log.isLoggable(Level.FINER)) s_log.finer(product.getName() + " = " + pp.Cost); return pp.Cost; } // calculateLiFo diff --git a/org.adempiere.base/src/org/compiere/model/MDepreciationConvention.java b/org.adempiere.base/src/org/compiere/model/MDepreciationConvention.java index f320202b2b..f7b72894f8 100644 --- a/org.adempiere.base/src/org/compiere/model/MDepreciationConvention.java +++ b/org.adempiere.base/src/org/compiere/model/MDepreciationConvention.java @@ -2,7 +2,6 @@ package org.compiere.model; import java.math.BigDecimal; import java.sql.CallableStatement; import java.sql.ResultSet; -import java.sql.SQLException; import java.util.Properties; import java.util.logging.Level; diff --git a/org.adempiere.base/src/org/compiere/model/MEntityType.java b/org.adempiere.base/src/org/compiere/model/MEntityType.java index 1b018b02fa..16edadf0fe 100644 --- a/org.adempiere.base/src/org/compiere/model/MEntityType.java +++ b/org.adempiere.base/src/org/compiere/model/MEntityType.java @@ -21,6 +21,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.StringTokenizer; +import java.util.logging.Level; + import static org.compiere.model.SystemIDs.*; import org.compiere.util.CLogger; @@ -44,7 +46,7 @@ public class MEntityType extends X_AD_EntityType /** * */ - private static final long serialVersionUID = 8906219523978497906L; + private static final long serialVersionUID = 4670009709141738924L; /** * Get Entity Types @@ -61,7 +63,7 @@ public class MEntityType extends X_AD_EntityType .list(); s_entityTypes = new MEntityType[list.size()]; list.toArray(s_entityTypes); - s_log.finer("# " + s_entityTypes.length); + if (s_log.isLoggable(Level.FINER)) s_log.finer("# " + s_entityTypes.length); return s_entityTypes; } // getEntityTypes @@ -99,7 +101,7 @@ public class MEntityType extends X_AD_EntityType list.add(s); retValue[i] = s; } - s_log.finer(list.toString()); + if (s_log.isLoggable(Level.FINER)) s_log.finer(list.toString()); return retValue; } // getEntityTypeStrings @@ -130,7 +132,7 @@ public class MEntityType extends X_AD_EntityType } String[] retValue = new String[list.size()]; list.toArray(retValue); - s_log.finer(list.toString()); + if (s_log.isLoggable(Level.FINER)) s_log.finer(list.toString()); return retValue; } // getClathpaths @@ -162,7 +164,7 @@ public class MEntityType extends X_AD_EntityType } String[] retValue = new String[list.size()]; list.toArray(retValue); - s_log.finer(list.toString()); + if (s_log.isLoggable(Level.FINER)) s_log.finer(list.toString()); return retValue; } // getModelPackages diff --git a/org.adempiere.base/src/org/compiere/model/MLookupFactory.java b/org.adempiere.base/src/org/compiere/model/MLookupFactory.java index 8d64f8e15e..d2ae7d3c28 100644 --- a/org.adempiere.base/src/org/compiere/model/MLookupFactory.java +++ b/org.adempiere.base/src/org/compiere/model/MLookupFactory.java @@ -367,8 +367,7 @@ public class MLookupFactory MLookupInfo retValue = (MLookupInfo)s_cacheRefTable.get(key.toString()); if (retValue != null) { - if (s_log.isLoggable(Level.FINEST)) - s_log.finest("Cache: " + retValue); + if (s_log.isLoggable(Level.FINEST)) s_log.finest("Cache: " + retValue); return retValue.cloneIt(); } // @@ -556,8 +555,7 @@ public class MLookupFactory else realSQL.append(" ORDER BY 3"); - if (s_log.isLoggable(Level.FINEST)) - s_log.finest("AD_Reference_Value_ID=" + AD_Reference_Value_ID + " - " + realSQL); + if (s_log.isLoggable(Level.FINEST)) s_log.finest("AD_Reference_Value_ID=" + AD_Reference_Value_ID + " - " + realSQL); if (overrideZoomWindow > 0) { ZoomWindow = overrideZoomWindow; diff --git a/org.adempiere.base/src/org/compiere/model/MSequence.java b/org.adempiere.base/src/org/compiere/model/MSequence.java index 8c13c87dd0..a282c56e15 100644 --- a/org.adempiere.base/src/org/compiere/model/MSequence.java +++ b/org.adempiere.base/src/org/compiere/model/MSequence.java @@ -548,7 +548,7 @@ public class MSequence extends X_AD_Sequence if (suffix != null && suffix.length() > 0) doc.append(Env.parseVariable(suffix, po, trxName, false)); String documentNo = doc.toString(); - s_log.finer (documentNo + " (" + incrementNo + ")" + if (s_log.isLoggable(Level.FINER)) s_log.finer (documentNo + " (" + incrementNo + ")" + " - Sequence=" + AD_Sequence_ID + " [" + trx + "]"); return documentNo; } @@ -596,7 +596,7 @@ public class MSequence extends X_AD_Sequence MDocType dt = MDocType.get (Env.getCtx(), C_DocType_ID); // wrong for SERVER, but r/o if (dt != null && !dt.isDocNoControlled()) { - s_log.finer("DocType_ID=" + C_DocType_ID + " Not DocNo controlled"); + if (s_log.isLoggable(Level.FINER)) s_log.finer("DocType_ID=" + C_DocType_ID + " Not DocNo controlled"); return null; } if (definite && ! dt.isOverwriteSeqOnComplete()) { diff --git a/org.adempiere.base/src/org/compiere/model/SetGetUtil.java b/org.adempiere.base/src/org/compiere/model/SetGetUtil.java index c40e8bc6db..4366b354cd 100644 --- a/org.adempiere.base/src/org/compiere/model/SetGetUtil.java +++ b/org.adempiere.base/src/org/compiere/model/SetGetUtil.java @@ -28,10 +28,10 @@ import java.sql.Timestamp; import java.util.ArrayList; import java.util.Collection; import java.util.Properties; +import java.util.logging.Level; import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.DBException; -import org.compiere.util.CLogMgt; import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; @@ -120,7 +120,7 @@ public class SetGetUtil { for (SetGetModel model : models) { - if(CLogMgt.isLevelFinest()) s_log.finest("Model: " + model); + if (s_log.isLoggable(Level.FINEST)) s_log.finest("Model: " + model); if (rs.next()) { if (columnNames == null) @@ -149,12 +149,12 @@ public class SetGetUtil } // ok = model.set_AttrValue(columnName, obj); - if (CLogMgt.isLevelFinest()) s_log.finest("columnName=" + columnName + ", value=[" + obj + "][" + (obj != null ? obj.getClass().getName() : "null") + "], ok=" + ok); + if (s_log.isLoggable(Level.FINEST)) s_log.finest("columnName=" + columnName + ", value=[" + obj + "][" + (obj != null ? obj.getClass().getName() : "null") + "], ok=" + ok); } } else { - s_log.finest("@NoResult@"); + if (s_log.isLoggable(Level.FINEST)) s_log.finest("@NoResult@"); break; } } @@ -234,7 +234,7 @@ public class SetGetUtil String[] includeFields, String[] excludeFields, boolean trackOnlyChanges) { - if (CLogMgt.isLevelFinest()) + if (s_log.isLoggable(Level.FINEST)) { s_log.finest("Entering: From=" + from+ " - To=" + to); // s_log.finest("includeFields=" + ARHIPAC.toString(includeFields)); @@ -243,7 +243,7 @@ public class SetGetUtil // if (to == null || from == null) { - if (CLogMgt.isLevelFinest()) + if (s_log.isLoggable(Level.FINEST)) { s_log.finest("Leaving: to == null || from == null"); Thread.dumpStack(); @@ -308,19 +308,19 @@ public class SetGetUtil //- if (isExcluded) { - if (CLogMgt.isLevelFinest()) s_log.finest("Field " + colName + " [SKIP:excluded]"); + if (s_log.isLoggable(Level.FINEST)) s_log.finest("Field " + colName + " [SKIP:excluded]"); continue; } int idx_to = to.get_ColumnIndex(colName); if (idx_to < 0) { - if (CLogMgt.isLevelFinest()) s_log.finest("Field " + colName + " [SKIP:idx_to < 0]"); + if (s_log.isLoggable(Level.FINEST)) s_log.finest("Field " + colName + " [SKIP:idx_to < 0]"); continue; } if (to.p_info.isVirtualColumn(idx_to) || to.p_info.isKey(idx_to)) { // KeyColumn - if (CLogMgt.isLevelFinest()) s_log.finest("Field " + colName + " [SKIP:virtual or key]"); + if (s_log.isLoggable(Level.FINEST)) s_log.finest("Field " + colName + " [SKIP:virtual or key]"); continue; } @@ -331,10 +331,10 @@ public class SetGetUtil { copiedFields++; } - if (CLogMgt.isLevelFinest()) s_log.finest("Field " + colName + "=[" + value + "], idx=" + idx_from + "->" + idx_to); + if (s_log.isLoggable(Level.FINEST)) s_log.finest("Field " + colName + "=[" + value + "], idx=" + idx_from + "->" + idx_to); } // - if (CLogMgt.isLevelFinest()) s_log.finest("Leaving: to=" + to); + if (s_log.isLoggable(Level.FINEST)) s_log.finest("Leaving: to=" + to); return copiedFields; } // copyValues