IDEMPIERE-638 Check log level before calling logging method / logger.info+fine

This commit is contained in:
Richard Morales 2013-02-22 17:17:40 -05:00
parent 427e8e08f2
commit 74d197cb57
12 changed files with 34 additions and 36 deletions

View File

@ -13,6 +13,8 @@
*****************************************************************************/
package org.adempiere.exceptions;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.model.PO;
import org.compiere.util.CLogger;
@ -68,7 +70,7 @@ public class PORelationException extends AdempiereException {
public static void throwWrongKeyColumnCount(final PO po) {
logger.fine("Invoked with po " + po);
if (logger.isLoggable(Level.FINE)) logger.fine("Invoked with po " + po);
final Object[] msgParams = new Object[] { po.toString(),
po.get_KeyColumns().length };

View File

@ -26,6 +26,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.PORelationException;
@ -143,7 +144,7 @@ public class MRelationType extends X_AD_RelationType implements IZoomProvider {
final List<MRelationType> result = evalResultSet(po, windowId, rs);
logger.info("There are " + result.size() + " matching types for "
if (logger.isLoggable(Level.INFO)) logger.info("There are " + result.size() + " matching types for "
+ po);
return result;
@ -294,7 +295,7 @@ public class MRelationType extends X_AD_RelationType implements IZoomProvider {
parsedWhere, po.get_TrxName()).first();
final boolean match = result != null;
logger.fine("whereClause='" + parsedWhere + "' matches po='" + po
if (logger.isLoggable(Level.FINE)) logger.fine("whereClause='" + parsedWhere + "' matches po='" + po
+ "':" + match);
return match;
}
@ -328,7 +329,7 @@ public class MRelationType extends X_AD_RelationType implements IZoomProvider {
final String parsedWhere = Env.parseContext(privateCtx, -1, where,
false);
logger.fine("whereClause='" + where + "'; parsedWhere='" + parsedWhere
if (logger.isLoggable(Level.FINE)) logger.fine("whereClause='" + where + "'; parsedWhere='" + parsedWhere
+ "'");
return parsedWhere;

View File

@ -95,7 +95,7 @@ public class ZoomInfoFactory {
if (alreadySeen.add(zoomInfo.destinationDisplay)) {
logger.fine("Adding zoomInfo " + zoomInfo);
if (logger.isLoggable(Level.FINE)) logger.fine("Adding zoomInfo " + zoomInfo);
result.add(zoomInfo);
}
}
@ -107,13 +107,13 @@ public class ZoomInfoFactory {
if (alreadySeen.add(zoomInfo.destinationDisplay)) {
logger.fine("Adding zoomInfo " + zoomInfo + " from "
if (logger.isLoggable(Level.FINE)) logger.fine("Adding zoomInfo " + zoomInfo + " from "
+ GenericZoomProvider.class.getSimpleName());
result.add(zoomInfo);
} else {
logger.fine("Skipping zoomInfo " + zoomInfo + " from "
if (logger.isLoggable(Level.FINE)) logger.fine("Skipping zoomInfo " + zoomInfo + " from "
+ GenericZoomProvider.class.getSimpleName()
+ " because there is already one for destination '"
+ zoomInfo.destinationDisplay + "'");

View File

@ -13,7 +13,6 @@ import org.compiere.process.DocAction;
import org.compiere.process.DocumentEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ProjectClose;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;

View File

@ -35,7 +35,7 @@ public class PipoDictionaryService implements IDictionaryService {
X_AD_Package_Imp_Proc adPackageImp = new X_AD_Package_Imp_Proc(Env.getCtx(),
0, trxName);
File zipFilepath = packageFile;
logger.info("zipFilepath->" + zipFilepath);
if (logger.isLoggable(Level.INFO)) logger.info("zipFilepath->" + zipFilepath);
String parentDir = Zipper.getParentDir(zipFilepath);
File targetDir = new File(System.getProperty("java.io.tmpdir"));
Zipper.unpackFile(zipFilepath, targetDir);
@ -43,7 +43,7 @@ public class PipoDictionaryService implements IDictionaryService {
String dict_file = targetDir + File.separator + parentDir + File.separator
+ "dict" + File.separator + "PackOut.xml";
logger.info("dict file->" + dict_file);
if (logger.isLoggable(Level.INFO)) logger.info("dict file->" + dict_file);
// call XML Handler
String msg = packIn.importXML(dict_file, Env.getCtx(), trxName);
@ -54,7 +54,7 @@ public class PipoDictionaryService implements IDictionaryService {
adPackageImp.saveEx();
Trx.get(trxName, false).commit();
logger.info("commit " + trxName);
if (logger.isLoggable(Level.INFO)) logger.info("commit " + trxName);
} catch (Exception e) {
logger.log(Level.SEVERE, "importXML:", e);
throw e;

View File

@ -25,12 +25,10 @@ public class AdempiereActivator implements BundleActivator {
@Override
public void start(BundleContext context) throws Exception {
this.context = context;
if (logger.isLoggable(Level.INFO))
logger.info(getName() + " " + getVersion() + " starting...");
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + getVersion() + " starting...");
installPackage();
start();
if (logger.isLoggable(Level.INFO))
logger.info(getName() + " " + getVersion() + " ready.");
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + getVersion() + " ready.");
}
public String getName() {
@ -80,11 +78,9 @@ public class AdempiereActivator implements BundleActivator {
if (pkg == null) {
packIn(trxName);
install();
if (logger.isLoggable(Level.INFO))
logger.info(getName() + " " + version + " installed.");
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + version + " installed.");
} else {
if (logger.isLoggable(Level.INFO))
logger.info(getName() + " " + version + " was installed: "
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + version + " was installed: "
+ pkg.getCreated());
}
Trx.get(trxName, false).commit();
@ -136,7 +132,7 @@ public class AdempiereActivator implements BundleActivator {
@Override
public void stop(BundleContext context) throws Exception {
stop();
logger.info(context.getBundle().getSymbolicName() + " "
if (logger.isLoggable(Level.INFO)) logger.info(context.getBundle().getSymbolicName() + " "
+ context.getBundle().getHeaders().get("Bundle-Version")
+ " stopped.");
}

View File

@ -98,7 +98,7 @@ public class AZoomAcross
windowID)) {
if (zoomInfo.query.getRecordCount() == 0) {
logger.fine("No target records for destination "
if (logger.isLoggable(Level.FINE)) logger.fine("No target records for destination "
+ zoomInfo.destinationDisplay);
continue;
}
@ -116,7 +116,7 @@ public class AZoomAcross
final int AD_Window_ID = zoomInfo.windowId;
final MQuery query = zoomInfo.query;
logger.info("AD_Window_ID=" + AD_Window_ID
if (logger.isLoggable(Level.INFO)) logger.info("AD_Window_ID=" + AD_Window_ID
+ " - " + query);
AWindow frame = new AWindow(null);

View File

@ -877,7 +877,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
public void onAttachment()
{
int record_ID = adTabbox.getSelectedGridTab().getRecord_ID();
logger.info("Record_ID=" + record_ID);
if (logger.isLoggable(Level.INFO)) logger.info("Record_ID=" + record_ID);
if (record_ID == -1) // No Key
{
@ -910,7 +910,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
public void onChat()
{
int recordId = adTabbox.getSelectedGridTab().getRecord_ID();
logger.info("Record_ID=" + recordId);
if (logger.isLoggable(Level.INFO)) logger.info("Record_ID=" + recordId);
if (recordId== -1) // No Key
{
@ -1244,8 +1244,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (!detailTab)
{
String dbInfo = e.getMessage();
if (logger.isLoggable(Level.INFO))
logger.info(dbInfo);
if (logger.isLoggable(Level.INFO)) logger.info(dbInfo);
if (adTabbox.getSelectedGridTab() != null && adTabbox.getSelectedGridTab().isQueryActive())
dbInfo = "[ " + dbInfo + " ]";
breadCrumb.setStatusDB(dbInfo, e);
@ -2086,7 +2085,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{
Listitem li = iter.next();
if(li != null)
logger.fine((String) li.getValue());
if (logger.isLoggable(Level.FINE)) logger.fine((String) li.getValue());
}
}
@ -2325,7 +2324,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
return;
}
logger.info(wButton.toString());
if (logger.isLoggable(Level.INFO)) logger.info(wButton.toString());
final String col = wButton.getColumnName();

View File

@ -149,8 +149,7 @@ public abstract class ADForm extends Window implements EventListener<Event>
}
else
{
if (logger.isLoggable(Level.INFO))
logger.info("AD_Form_ID=" + adFormID + " - Class=" + formName);
if (logger.isLoggable(Level.INFO)) logger.info("AD_Form_ID=" + adFormID + " - Class=" + formName);
form = Extensions.getForm(formName);
if (form != null)

View File

@ -19,6 +19,7 @@ import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.util.Callback;
@ -445,7 +446,7 @@ public class ResetPasswordPanel extends Window implements EventListener<Event>
user.saveEx();
if (sendEmail(user, newPassword))
logger.fine(user.getEMail());
if (logger.isLoggable(Level.FINE)) logger.fine(user.getEMail());
else
{
if (errorMsg.length() > 0)

View File

@ -111,7 +111,7 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
return;
}
logger.fine("DocStatus=" + DocStatus
if (logger.isLoggable(Level.FINE)) logger.fine("DocStatus=" + DocStatus
+ ", DocAction=" + DocAction + ", OrderType=" + OrderType
+ ", IsSOTrx=" + IsSOTrx + ", Processing=" + Processing
+ ", AD_Table_ID=" +gridTab.getAD_Table_ID() + ", Record_ID=" + gridTab.getRecord_ID());
@ -164,7 +164,7 @@ public class WDocActionPanel extends Window implements EventListener<Event>, Dia
if(doctypeId==null || doctypeId.intValue()==0){
doctypeId = (Integer)gridTab.getValue("C_DocTypeTarget_ID");
}
logger.fine("get doctype: " + doctypeId);
if (logger.isLoggable(Level.FINE)) logger.fine("get doctype: " + doctypeId);
if (doctypeId != null) {
index = DocumentEngine.checkActionAccess(Env.getAD_Client_ID(Env.getCtx()),
Env.getAD_Role_ID(Env.getCtx()),

View File

@ -18,6 +18,7 @@
package org.adempiere.webui.window;
import java.util.Properties;
import java.util.logging.Level;
import org.compiere.util.CLogMgt;
import org.compiere.util.CLogger;
@ -119,7 +120,7 @@ public class FDialog
Properties ctx = Env.getCtx();
StringBuffer out = null;
logger.info(adMessage + " - " + message);
if (logger.isLoggable(Level.INFO)) logger.info(adMessage + " - " + message);
out = constructMessage(adMessage, message);
@ -216,7 +217,7 @@ public class FDialog
Properties ctx = Env.getCtx();
StringBuffer out = new StringBuffer();
logger.info(adMessage + " - " + message);
if (logger.isLoggable(Level.INFO)) logger.info(adMessage + " - " + message);
if (CLogMgt.isLevelFinest())
{
@ -347,7 +348,7 @@ public class FDialog
StringBuffer out = new StringBuffer();
logger.info(adMessage + " - " + message);
if (logger.isLoggable(Level.INFO)) logger.info(adMessage + " - " + message);
if (CLogMgt.isLevelFinest())
{