From fee2df24c9bb1a7ba8aee8e41584531f159d840e Mon Sep 17 00:00:00 2001 From: Richard Morales Date: Thu, 21 Feb 2013 12:11:33 -0500 Subject: [PATCH] IDEMPIERE-638 Check log level before calling logging method / s_log.config --- .../compiere/process/DocumentTypeVerify.java | 4 +-- .../src/org/compiere/model/MCost.java | 4 +-- .../src/org/compiere/model/MCostDetail.java | 26 +++++++++---------- .../src/org/compiere/model/MCostQueue.java | 6 ++--- .../src/org/compiere/model/MInvoice.java | 2 +- .../src/org/compiere/model/MPayment.java | 2 +- .../src/org/compiere/print/MPrintPaper.java | 6 ++--- .../src/org/compiere/wf/MWorkflow.java | 2 +- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/org.adempiere.base.process/src/org/compiere/process/DocumentTypeVerify.java b/org.adempiere.base.process/src/org/compiere/process/DocumentTypeVerify.java index 9ba8455f4e..7b0934dea9 100644 --- a/org.adempiere.base.process/src/org/compiere/process/DocumentTypeVerify.java +++ b/org.adempiere.base.process/src/org/compiere/process/DocumentTypeVerify.java @@ -88,7 +88,7 @@ public class DocumentTypeVerify extends SvrProcess { String name = rs.getString(2); String value = rs.getString(1); - s_log.config(name + "=" + value); + if (s_log.isLoggable(Level.CONFIG)) s_log.config(name + "=" + value); MDocType dt = new MDocType (ctx, value, name, trxName); if (dt.save()) { @@ -166,7 +166,7 @@ public class DocumentTypeVerify extends SvrProcess int Client_ID = rs.getInt(1); int C_Period_ID = rs.getInt(2); String DocBaseType = rs.getString(3); - s_log.config("AD_Client_ID=" + Client_ID + if (s_log.isLoggable(Level.CONFIG)) s_log.config("AD_Client_ID=" + Client_ID + ", C_Period_ID=" + C_Period_ID + ", DocBaseType=" + DocBaseType); // MPeriodControl pc = new MPeriodControl (ctx, Client_ID, diff --git a/org.adempiere.base/src/org/compiere/model/MCost.java b/org.adempiere.base/src/org/compiere/model/MCost.java index bc56987df0..7e26d01d67 100644 --- a/org.adempiere.base/src/org/compiere/model/MCost.java +++ b/org.adempiere.base/src/org/compiere/model/MCost.java @@ -725,7 +725,7 @@ public class MCost extends X_M_Cost if (cost.is_new()) { if (cost.save()) - s_log.config("Std.Cost for " + product.getName() + if (s_log.isLoggable(Level.CONFIG)) s_log.config("Std.Cost for " + product.getName() + " - " + as.getName()); else s_log.warning("Not created: Std.Cost for " + product.getName() @@ -743,7 +743,7 @@ public class MCost extends X_M_Cost if (cost.is_new()) { if (cost.save()) - s_log.config("Std.Cost for " + product.getName() + if (s_log.isLoggable(Level.CONFIG)) s_log.config("Std.Cost for " + product.getName() + " - " + o.getName() + " - " + as.getName()); else diff --git a/org.adempiere.base/src/org/compiere/model/MCostDetail.java b/org.adempiere.base/src/org/compiere/model/MCostDetail.java index 430b9fedce..1dd4f26889 100644 --- a/org.adempiere.base/src/org/compiere/model/MCostDetail.java +++ b/org.adempiere.base/src/org/compiere/model/MCostDetail.java @@ -80,7 +80,7 @@ public class MCostDetail extends X_M_CostDetail .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID); int no = DB.executeUpdate(sql.toString(), trxName); if (no != 0) - s_log.config("Deleted #" + no); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("Deleted #" + no); MCostDetail cd = get (as.getCtx(), "C_OrderLine_ID=?", C_OrderLine_ID, M_AttributeSetInstance_ID, as.getC_AcctSchema_ID(), trxName); // @@ -113,7 +113,7 @@ public class MCostDetail extends X_M_CostDetail { ok = cd.process(); } - s_log.config("(" + ok + ") " + cd); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("(" + ok + ") " + cd); return ok; } // createOrder @@ -147,7 +147,7 @@ public class MCostDetail extends X_M_CostDetail .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID); int no = DB.executeUpdate(sql.toString(), trxName); if (no != 0) - s_log.config("Deleted #" + no); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("Deleted #" + no); MCostDetail cd = get (as.getCtx(), "C_InvoiceLine_ID=?", C_InvoiceLine_ID, M_AttributeSetInstance_ID, as.getC_AcctSchema_ID(), trxName); // @@ -180,7 +180,7 @@ public class MCostDetail extends X_M_CostDetail { ok = cd.process(); } - s_log.config("(" + ok + ") " + cd); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("(" + ok + ") " + cd); return ok; } // createInvoice @@ -214,7 +214,7 @@ public class MCostDetail extends X_M_CostDetail .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID); int no = DB.executeUpdate(sql.toString(), trxName); if (no != 0) - s_log.config("Deleted #" + no); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("Deleted #" + no); MCostDetail cd = get (as.getCtx(), "M_InOutLine_ID=?", M_InOutLine_ID, M_AttributeSetInstance_ID, as.getC_AcctSchema_ID(), trxName); // @@ -248,7 +248,7 @@ public class MCostDetail extends X_M_CostDetail { ok = cd.process(); } - s_log.config("(" + ok + ") " + cd); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("(" + ok + ") " + cd); return ok; } // createShipment @@ -281,7 +281,7 @@ public class MCostDetail extends X_M_CostDetail .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID); int no = DB.executeUpdate(sql.toString(), trxName); if (no != 0) - s_log.config("Deleted #" + no); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("Deleted #" + no); MCostDetail cd = get (as.getCtx(), "M_InventoryLine_ID=?", M_InventoryLine_ID, M_AttributeSetInstance_ID, as.getC_AcctSchema_ID(), trxName); // @@ -314,7 +314,7 @@ public class MCostDetail extends X_M_CostDetail { ok = cd.process(); } - s_log.config("(" + ok + ") " + cd); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("(" + ok + ") " + cd); return ok; } // createInventory @@ -349,7 +349,7 @@ public class MCostDetail extends X_M_CostDetail .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID); int no = DB.executeUpdate(sql.toString(), trxName); if (no != 0) - s_log.config("Deleted #" + no); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("Deleted #" + no); StringBuilder msget = new StringBuilder( "M_MovementLine_ID=? AND IsSOTrx=") .append((from ? "'Y'" : "'N'")); MCostDetail cd = get (as.getCtx(),msget.toString(), @@ -385,7 +385,7 @@ public class MCostDetail extends X_M_CostDetail { ok = cd.process(); } - s_log.config("(" + ok + ") " + cd); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("(" + ok + ") " + cd); return ok; } // createMovement @@ -418,7 +418,7 @@ public class MCostDetail extends X_M_CostDetail .append(" AND M_AttributeSetInstance_ID=").append(M_AttributeSetInstance_ID); int no = DB.executeUpdate(sql.toString(), trxName); if (no != 0) - s_log.config("Deleted #" + no); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("Deleted #" + no); MCostDetail cd = get (as.getCtx(), "M_ProductionLine_ID=?", M_ProductionLine_ID, M_AttributeSetInstance_ID, as.getC_AcctSchema_ID(), trxName); // @@ -451,7 +451,7 @@ public class MCostDetail extends X_M_CostDetail { ok = cd.process(); } - s_log.config("(" + ok + ") " + cd); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("(" + ok + ") " + cd); return ok; } // createProduction @@ -547,7 +547,7 @@ public class MCostDetail extends X_M_CostDetail else counterError++; } - s_log.config("OK=" + counterOK + ", Errors=" + counterError); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("OK=" + counterOK + ", Errors=" + counterError); return counterError == 0; } // processProduct diff --git a/org.adempiere.base/src/org/compiere/model/MCostQueue.java b/org.adempiere.base/src/org/compiere/model/MCostQueue.java index b4c8057126..1720e47cfb 100644 --- a/org.adempiere.base/src/org/compiere/model/MCostQueue.java +++ b/org.adempiere.base/src/org/compiere/model/MCostQueue.java @@ -259,7 +259,7 @@ public class MCostQueue extends X_M_CostQueue lastPrice = queue.getCurrentCostPrice(); BigDecimal costBatch = lastPrice.multiply(remainingQty); cost = cost.add(costBatch); - s_log.config("ASI=" + queue.getM_AttributeSetInstance_ID() + if (s_log.isLoggable(Level.CONFIG)) s_log.config("ASI=" + queue.getM_AttributeSetInstance_ID() + " - Cost=" + lastPrice + " * Qty=" + remainingQty + "(!) = " + costBatch); return cost; } @@ -281,7 +281,7 @@ public class MCostQueue extends X_M_CostQueue // Done if (remainingQty.signum() == 0) { - s_log.config("Cost=" + cost); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("Cost=" + cost); return cost; } if (firstPrice == null) @@ -303,7 +303,7 @@ public class MCostQueue extends X_M_CostQueue BigDecimal costBatch = lastPrice.multiply(remainingQty); s_log.fine("RemainingQty=" + remainingQty + " * LastPrice=" + lastPrice + " = " + costBatch); cost = cost.add(costBatch); - s_log.config("Cost=" + cost); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("Cost=" + cost); return cost; } // getCosts diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 68c7068317..a5e09fea0a 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -1191,7 +1191,7 @@ public class MInvoice extends X_C_Invoice implements DocAction finally { DB.close(rs); } - s_log.config("#" + counter); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("#" + counter); /**/ } // setIsPaid diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index a415869aed..ed2d8b8f0e 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -872,7 +872,7 @@ public final class MPayment extends X_C_Payment rs = null; pstmt = null; } - s_log.config("#" + counter); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("#" + counter); } // setIsAllocated /************************************************************************** diff --git a/org.adempiere.base/src/org/compiere/print/MPrintPaper.java b/org.adempiere.base/src/org/compiere/print/MPrintPaper.java index 70155232b2..d6bac9167c 100644 --- a/org.adempiere.base/src/org/compiere/print/MPrintPaper.java +++ b/org.adempiere.base/src/org/compiere/print/MPrintPaper.java @@ -18,6 +18,7 @@ package org.compiere.print; import java.sql.ResultSet; import java.util.Properties; +import java.util.logging.Level; import javax.print.attribute.EnumSyntax; import javax.print.attribute.Size2DSyntax; @@ -52,8 +53,7 @@ public class MPrintPaper extends X_AD_PrintPaper /** * */ - private static final long serialVersionUID = 8284757169766494111L; - + private static final long serialVersionUID = -3609557177958141344L; /** * Get Paper @@ -70,7 +70,7 @@ public class MPrintPaper extends X_AD_PrintPaper s_papers.put(key, pp); } else - s_log.config("AD_PrintPaper_ID=" + AD_PrintPaper_ID); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("AD_PrintPaper_ID=" + AD_PrintPaper_ID); return pp; } // get diff --git a/org.adempiere.base/src/org/compiere/wf/MWorkflow.java b/org.adempiere.base/src/org/compiere/wf/MWorkflow.java index c84cb5917b..8839bc8a0d 100644 --- a/org.adempiere.base/src/org/compiere/wf/MWorkflow.java +++ b/org.adempiere.base/src/org/compiere/wf/MWorkflow.java @@ -121,7 +121,7 @@ public class MWorkflow extends X_AD_Workflow list.toArray(wfs); s_cacheDocValue.put (oldKey, wfs); } - s_log.config("#" + s_cacheDocValue.size()); + if (s_log.isLoggable(Level.CONFIG)) s_log.config("#" + s_cacheDocValue.size()); } // Look for Entry MWorkflow[] retValue = (MWorkflow[])s_cacheDocValue.get(key);