Author: jonesde
Date: Fri Feb 6 06:04:58 2009 New Revision: 741424 URL: http://svn.apache.org/viewvc?rev=741424&view=rev Log: Cleanup and pretty-up a bunch of log statements; moved some less helpful ones to verbose, combined some, and generally tried to make logs in various places more user friendly Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupReader.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Fri Feb 6 06:04:58 2009 @@ -328,7 +328,7 @@ if ("FIN_ACCOUNT".equals(checkOutPaymentId)) { finAccountId = splitStr[1]; } - Debug.log("Split checkOutPaymentId: " + splitStr[0] + " / " + splitStr[1], module); + if (Debug.verboseOn()) Debug.logVerbose("Split checkOutPaymentId: " + splitStr[0] + " / " + splitStr[1], module); } // get the selected amount to use @@ -768,7 +768,7 @@ adjs = new LinkedList(); } csi.setItemInfo(item, adjs); - Debug.log("Added item adjustments to ship group [" + i + " / " + x + "] - " + adjs, module); + if (Debug.verboseOn()) Debug.logVerbose("Added item adjustments to ship group [" + i + " / " + x + "] - " + adjs, module); } } @@ -1076,10 +1076,10 @@ // check to see if we should auto-invoice/bill if (faceToFace) { - Debug.log("Face-To-Face Sale - " + orderId, module); + if (Debug.verboseOn()) Debug.logVerbose("Face-To-Face Sale - " + orderId, module); CheckOutHelper.adjustFaceToFacePayment(orderId, orderTotal, allPaymentPreferences, userLogin, delegator); boolean ok = OrderChangeHelper.completeOrder(dispatcher, userLogin, orderId); - Debug.log("Complete Order Result - " + ok, module); + if (Debug.verboseOn()) Debug.logVerbose("Complete Order Result - " + ok, module); if (!ok) { throw new GeneralException("Problem with order change; see error logs"); } @@ -1454,7 +1454,7 @@ String paymentMethodId = (String) i.next(); BigDecimal paymentAmount = cart.getPaymentAmount(paymentMethodId); if (paymentAmount == null || paymentAmount.compareTo(BigDecimal.ZERO) == 0) { - Debug.log("Found null paymentMethodId - " + paymentMethodId, module); + if (Debug.verboseOn()) Debug.logVerbose("Found null paymentMethodId - " + paymentMethodId, module); nullPaymentIds.add(paymentMethodId); } } @@ -1468,17 +1468,17 @@ ShoppingCart.CartPaymentInfo info = cart.getPaymentInfo(paymentMethodId); - Debug.log("Remaining total is - " + newAmount, module); + if (Debug.verboseOn()) Debug.logVerbose("Remaining total is - " + newAmount, module); if (newAmount.compareTo(BigDecimal.ZERO) > 0) { info.amount = newAmount; - Debug.log("Set null paymentMethodId - " + info.paymentMethodId + " / " + info.amount, module); + if (Debug.verboseOn()) Debug.logVerbose("Set null paymentMethodId - " + info.paymentMethodId + " / " + info.amount, module); } else { info.amount = BigDecimal.ZERO; - Debug.log("Set null paymentMethodId - " + info.paymentMethodId + " / " + info.amount, module); + if (Debug.verboseOn()) Debug.logVerbose("Set null paymentMethodId - " + info.paymentMethodId + " / " + info.amount, module); } if (!setOverflow) { info.overflow = setOverflow = true; - Debug.log("Set overflow flag on payment - " + info.paymentMethodId, module); + if (Debug.verboseOn()) Debug.logVerbose("Set overflow flag on payment - " + info.paymentMethodId, module); } } } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java Fri Feb 6 06:04:58 2009 @@ -547,7 +547,7 @@ } } if (UtilValidate.isNotEmpty(properties)) { - Debug.logInfo("Loaded " + properties.size() + " properties for: " + resource + " (" + locale + ")", module); + if (Debug.verboseOn()) Debug.logVerbose("Loaded " + properties.size() + " properties for: " + resource + " (" + locale + ")", module); } return properties; } @@ -840,6 +840,7 @@ double startTime = System.currentTimeMillis(); FastList<Locale> candidateLocales = (FastList<Locale>) getCandidateLocales(locale); UtilResourceBundle parentBundle = null; + int numProperties = 0; while (candidateLocales.size() > 0) { Locale candidateLocale = candidateLocales.removeLast(); // ResourceBundles are connected together as a singly-linked list @@ -852,6 +853,7 @@ parentBundle = bundle; bundle = new UtilResourceBundle(newProps, candidateLocale, parentBundle); bundleCache.put(lookupName, bundle); + numProperties = newProps.size(); } } else { parentBundle = bundle; @@ -865,7 +867,7 @@ bundle = new UtilResourceBundle(bundle.properties, locale, parentBundle); } double totalTime = System.currentTimeMillis() - startTime; - Debug.logInfo("ResourceBundle " + resource + " (" + locale + ") created in " + totalTime + " mS", module); + Debug.logInfo("ResourceBundle " + resource + " (" + locale + ") created in " + totalTime/1000.0 + "s with " + numProperties + " properties", module); bundleCache.put(resourceName, bundle); } } Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java (original) +++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilXml.java Fri Feb 6 06:04:58 2009 @@ -243,7 +243,7 @@ document = builder.parse(is); double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0; - if (Debug.timingOn()) Debug.logTiming("XML Read " + totalSeconds + "s: " + docDescription, module); + if (Debug.verboseOn()) Debug.logVerbose("XML Read " + totalSeconds + "s: " + docDescription, module); return document; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Fri Feb 6 06:04:58 2009 @@ -967,7 +967,7 @@ } String sql = sqlBuffer.toString(); - Debug.logInfo("Count select sql: " + sql, module); + if (Debug.verboseOn()) Debug.logVerbose("Count select sql: " + sql, module); SQLProcessor sqlP = new SQLProcessor(helperName); sqlP.prepareStatement(sql, findOptions.getSpecifyTypeAndConcur(), findOptions.getResultSetType(), Modified: ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java (original) +++ ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/eca/EntityEcaUtil.java Fri Feb 6 06:04:58 2009 @@ -124,7 +124,7 @@ rules.add(new EntityEcaRule(e)); numDefs++; } - Debug.logImportant("Loaded " + numDefs + " Entity ECA definitions from " + handler.getLocation() + " in loader " + handler.getLoaderName(), module); + Debug.logImportant("Loaded [" + numDefs + "] Entity ECA definitions from " + handler.getLocation() + " in loader " + handler.getLoaderName(), module); } public static Collection<EntityEcaRule> getEntityEcaRules(GenericDelegator delegator, String entityName, String event) { Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java Fri Feb 6 06:04:58 2009 @@ -126,7 +126,7 @@ ctx.setDispatcher(this); ctx.loadReaders(); - if (Debug.infoOn()) Debug.logInfo("[LocalDispatcher] : Created Dispatcher for: " + name, module); + if (Debug.verboseOn()) Debug.logVerbose("[LocalDispatcher] : Created Dispatcher for: " + name, module); } public void disableEcas(){ Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java Fri Feb 6 06:04:58 2009 @@ -26,7 +26,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Set; import javax.xml.parsers.ParserConfigurationException; @@ -52,6 +51,8 @@ import org.w3c.dom.NodeList; import org.xml.sax.SAXException; +import freemarker.template.utility.StringUtil; + /** * Generic Service - Service Definition Reader */ @@ -202,11 +203,11 @@ } if (this.isFromURL) { utilTimer.timerString("Finished file " + readerURL + " - Total Services: " + i + " FINISHED"); - Debug.logImportant("Loaded " + i + " Service definitions from " + readerURL, module); + Debug.logImportant("Loaded [" + StringUtil.leftPad(Integer.toString(i), 3) + "] Services from " + readerURL, module); } else { utilTimer.timerString("Finished document in " + handler + " - Total Services: " + i + " FINISHED"); if (Debug.importantOn()) { - Debug.logImportant("Loaded " + i + " Service definitions from " + resourceLocation, module); + Debug.logImportant("Loaded [" + StringUtil.leftPad(Integer.toString(i), 3) + "] Services from " + resourceLocation, module); } } } @@ -440,7 +441,7 @@ groupElement.setAttribute("name", "_" + service.name + ".group"); service.internalGroup = new GroupModel(groupElement); service.invoke = service.internalGroup.getGroupName(); - Debug.logWarning("Created INTERNAL GROUP model [" + service.internalGroup + "]", module); + if (Debug.verboseOn()) Debug.logVerbose("Created INTERNAL GROUP model [" + service.internalGroup + "]", module); } } @@ -554,7 +555,7 @@ // default value String defValue = attribute.getAttribute("default-value"); if (UtilValidate.isNotEmpty(defValue)) { - Debug.logInfo("Got a default-value [" + defValue + "] for service attribute [" + service.name + "." + param.name + "]", module); + if (Debug.verboseOn()) Debug.logVerbose("Got a default-value [" + defValue + "] for service attribute [" + service.name + "." + param.name + "]", module); param.setDefaultValue(defValue.intern()); } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Fri Feb 6 06:04:58 2009 @@ -166,7 +166,7 @@ * @param context the context of the local dispatcher */ public void register(String name, DispatchContext context) { - if (Debug.infoOn()) Debug.logInfo("Registered dispatcher: " + context.getName(), module); + if (Debug.verboseOn()) Debug.logVerbose("Registered dispatcher: " + context.getName(), module); this.localContext.put(name, context); } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java Fri Feb 6 06:04:58 2009 @@ -38,6 +38,8 @@ import org.ofbiz.service.config.ServiceConfigUtil; import org.w3c.dom.Element; +import freemarker.template.utility.StringUtil; + /** * ServiceEcaUtil */ @@ -112,7 +114,7 @@ numDefs++; } if (Debug.importantOn()) { - Debug.logImportant("Loaded [" + numDefs + "] Service ECA definitions from " + resourceLocation, module); + Debug.logImportant("Loaded [" + StringUtil.leftPad(Integer.toString(numDefs), 2) + "] Service ECA Rules from " + resourceLocation, module); } } Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupReader.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupReader.java (original) +++ ofbiz/trunk/framework/service/src/org/ofbiz/service/group/ServiceGroupReader.java Fri Feb 6 06:04:58 2009 @@ -87,7 +87,7 @@ } catch (GenericConfigException e) { Debug.logError(e, "Could not get resource URL", module); } - Debug.logImportant("Loaded " + numDefs + " Group definitions from " + resourceLocation, module); + Debug.logImportant("Loaded [" + numDefs + "] Group definitions from " + resourceLocation, module); } } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java Fri Feb 6 06:04:58 2009 @@ -104,12 +104,19 @@ Element rootElement = loadDocument(url); if (rootElement != null) { - loadIncludes(rootElement); + long startTime = System.currentTimeMillis(); + loadIncludes(rootElement); loadGeneralConfig(rootElement); loadHandlerMap(rootElement); loadRequestMap(rootElement); loadViewMap(rootElement); + + if (Debug.infoOn()) { + double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0; + String locString = this.url.toExternalForm(); + Debug.logInfo("controller loaded: " + totalSeconds + "s, " + this.requestMapMap.size() + " requests, " + this.viewMapMap.size() + " views in " + locString, module); + } } } @@ -150,7 +157,6 @@ } protected void loadGeneralConfig(Element rootElement) { - long startTime = System.currentTimeMillis(); if (rootElement == null) { rootElement = loadDocument(this.url); } @@ -206,14 +212,9 @@ this.beforeLogoutEventList.add(new Event(eventElement)); } } - - double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0; - long totalRecords = this.firstVisitEventList.size() + this.preprocessorEventList.size() + this.postprocessorEventList.size() + this.afterLoginEventList.size() + this.beforeLogoutEventList.size(); - if (Debug.infoOn()) Debug.logInfo("General Configuration Loaded: (" + totalRecords + ") records in " + totalSeconds + "s", module); } public void loadHandlerMap(Element rootElement) { - long startTime = System.currentTimeMillis(); if (rootElement == null) { rootElement = loadDocument(this.url); } @@ -230,13 +231,9 @@ this.eventHandlerMap.put(name, className); } } - - double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0; - if (Debug.infoOn()) Debug.logInfo("View and Event Handler Maps Created: (" + this.viewHandlerMap.size() + ") view handlers and (" + this.eventHandlerMap.size() + ") request/event handlers in " + totalSeconds + "s", module); } public void loadRequestMap(Element root) { - long startTime = System.currentTimeMillis(); if (root == null) { root = loadDocument(this.url); } @@ -246,13 +243,9 @@ RequestMap requestMap = new RequestMap(requestMapElement); this.requestMapMap.put(requestMap.uri, requestMap); } - - double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0; - if (Debug.infoOn()) Debug.logInfo("RequestMap Created: (" + this.requestMapMap.size() + ") records in " + totalSeconds + "s", module); } public void loadViewMap(Element rootElement) { - long startTime = System.currentTimeMillis(); if (rootElement == null) { rootElement = loadDocument(this.url); } @@ -263,9 +256,6 @@ ViewMap viewMap = new ViewMap(viewMapElement); this.viewMapMap.put(viewMap.name, viewMap); } - - double totalSeconds = (System.currentTimeMillis() - startTime)/1000.0; - if (Debug.infoOn()) Debug.logInfo("ViewMap Created: (" + this.viewMapMap.size() + ") records in " + totalSeconds + "s", module); } } Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java Fri Feb 6 06:04:58 2009 @@ -320,7 +320,7 @@ if (delegatorName == null || delegatorName.length() <= 0) { delegatorName = "default"; } - if (Debug.infoOn()) Debug.logInfo("[ContextFilter.init] Getting Entity Engine Delegator with delegator name " + delegatorName, module); + if (Debug.infoOn()) Debug.logInfo("Setup Entity Engine Delegator with name " + delegatorName, module); delegator = GenericDelegator.getGenericDelegator(delegatorName); config.getServletContext().setAttribute("delegator", delegator); if (delegator == null) { @@ -355,7 +355,7 @@ while (initParamEnum.hasMoreElements()) { String initParamName = (String) initParamEnum.nextElement(); String initParamValue = config.getServletContext().getInitParameter(initParamName); - if (Debug.infoOn()) Debug.logInfo("Adding web.xml context-param to application attribute with name [" + initParamName + "] and value [" + initParamValue + "]", module); + if (Debug.verboseOn()) Debug.logVerbose("Adding web.xml context-param to application attribute with name [" + initParamName + "] and value [" + initParamValue + "]", module); config.getServletContext().setAttribute(initParamName, initParamValue); } String GeronimoMultiOfbizInstances = (String) config.getServletContext().getAttribute("GeronimoMultiOfbizInstances"); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java Fri Feb 6 06:04:58 2009 @@ -61,9 +61,7 @@ */ public void init(ServletConfig config) throws ServletException { super.init(config); - if (Debug.infoOn()) { - Debug.logInfo("[ControlServlet.init] Loading Control Servlet mounted on path " + config.getServletContext().getRealPath("/"), module); - } + if (Debug.infoOn()) Debug.logInfo("LOADING WEBAPP [" + config.getServletContext().getContextPath().substring(1) + "] " + config.getServletContext().getServletContextName() + ", located at " + config.getServletContext().getRealPath("/"), module); // configure custom BSF engines configureBsf(); Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java?rev=741424&r1=741423&r2=741424&view=diff ============================================================================== --- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java (original) +++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Fri Feb 6 06:04:58 2009 @@ -82,7 +82,7 @@ private EventFactory eventFactory = null; public void init(ServletContext context) { - Debug.logInfo("[RequestHandler Loading...]", module); + if (Debug.verboseOn()) Debug.logVerbose("[RequestHandler Loading...]", module); this.context = context; this.controllerConfig = ConfigXMLReader.getControllerConfig(ConfigXMLReader.getControllerConfigURL(context)); |
Free forum by Nabble | Edit this page |