Author: jonesde
Date: Wed May 23 11:47:11 2007 New Revision: 541022 URL: http://svn.apache.org/viewvc?view=rev&rev=541022 Log: A few changes to better handle errors and to log less information that isn't so critical by default, ie use more verbose instead of info; this is based on some production log reviews Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAsText.java ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java ofbiz/trunk/framework/common/script/org/ofbiz/common/CdyneServices.xml Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAsText.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAsText.java?view=diff&rev=541022&r1=541021&r2=541022 ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAsText.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAsText.java Wed May 23 11:47:11 2007 @@ -63,12 +63,12 @@ final HttpServletRequest request = (HttpServletRequest) FreeMarkerWorker.getWrappedObject("request", env); final HttpServletResponse response = (HttpServletResponse) FreeMarkerWorker.getWrappedObject("response", env); final Map templateRoot = FreeMarkerWorker.createEnvironmentMap(env); - if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, contentId(0):" + templateRoot.get("contentId"), module); + if (Debug.verboseOn()) Debug.logVerbose("in RenderSubContent, contentId(0):" + templateRoot.get("contentId"), module); FreeMarkerWorker.getSiteParameters(request, templateRoot); final Map savedValuesUp = new HashMap(); FreeMarkerWorker.saveContextValues(templateRoot, upSaveKeyNames, savedValuesUp); FreeMarkerWorker.overrideWithArgs(templateRoot, args); - if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, contentId(2):" + templateRoot.get("contentId"), module); + if (Debug.verboseOn()) Debug.logVerbose("in RenderSubContent, contentId(2):" + templateRoot.get("contentId"), module); // not used yet: final GenericValue userLogin = (GenericValue) FreeMarkerWorker.getWrappedObject("userLogin", env); // not used yet: List trail = (List)templateRoot.get("globalNodeTrail"); //if (Debug.infoOn()) Debug.logInfo("in Render(0), globalNodeTrail ." + trail , module); @@ -78,7 +78,7 @@ final String thisContentId = (String)templateRoot.get("contentId"); final String xmlEscape = (String)templateRoot.get("xmlEscape"); final boolean directAssocMode = UtilValidate.isNotEmpty(thisContentId) ? true : false; - if (Debug.infoOn()) Debug.logInfo("in Render(0), directAssocMode ." + directAssocMode , module); + if (Debug.verboseOn()) Debug.logVerbose("in Render(0), directAssocMode ." + directAssocMode , module); /* if (Debug.infoOn()) Debug.logInfo("in Render(0), thisSubContentId ." + thisSubContentId , module); String thisSubContentId = (String)templateRoot.get("subContentId"); @@ -133,9 +133,9 @@ public void close() throws IOException { List globalNodeTrail = (List)templateRoot.get("globalNodeTrail"); - if (Debug.infoOn()) Debug.logInfo("Render close, globalNodeTrail(2a):" + ContentWorker.nodeTrailToCsv(globalNodeTrail), ""); + if (Debug.verboseOn()) Debug.logVerbose("Render close, globalNodeTrail(2a):" + ContentWorker.nodeTrailToCsv(globalNodeTrail), ""); renderSubContent(); - //if (Debug.infoOn()) Debug.logInfo("in Render(2), globalNodeTrail ." + getWrapped(env, "globalNodeTrail") , module); + //if (Debug.verboseOn()) Debug.logVerbose("in Render(2), globalNodeTrail ." + getWrapped(env, "globalNodeTrail") , module); } public void renderSubContent() throws IOException { @@ -152,7 +152,7 @@ // Timestamp fromDate = UtilDateTime.nowTimestamp(); // List passedGlobalNodeTrail = (List)templateRoot.get("globalNodeTrail"); String editRequestName = (String)templateRoot.get("editRequestName"); - if (Debug.infoOn()) Debug.logInfo("in Render(3), editRequestName ." + editRequestName , module); + if (Debug.verboseOn()) Debug.logVerbose("in Render(3), editRequestName ." + editRequestName , module); /* GenericValue thisView = null; if (view != null) { @@ -163,8 +163,8 @@ if (map != null) thisView = (GenericValue)map.get("value"); } - if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, subContentId:" + templateRoot.get("subContentId"), module); - if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, contentId:" + templateRoot.get("contentId"), module); + if (Debug.verboseOn()) Debug.logVerbose("in RenderSubContent, subContentId:" + templateRoot.get("subContentId"), module); + if (Debug.verboseOn()) Debug.logVerbose("in RenderSubContent, contentId:" + templateRoot.get("contentId"), module); */ if (UtilValidate.isNotEmpty(editRequestName)) { @@ -172,8 +172,8 @@ openEditWrap(out, editStyle); } - if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, contentId(2):" + templateRoot.get("contentId"), module); - if (Debug.infoOn()) Debug.logInfo("in RenderSubContent, subContentId(2):" + templateRoot.get("subContentId"), module); + if (Debug.verboseOn()) Debug.logVerbose("in RenderSubContent, contentId(2):" + templateRoot.get("contentId"), module); + if (Debug.verboseOn()) Debug.logVerbose("in RenderSubContent, subContentId(2):" + templateRoot.get("subContentId"), module); FreeMarkerWorker.saveContextValues(templateRoot, saveKeyNames, savedValues); //if (thisView != null) { try { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java?view=diff&rev=541022&r1=541021&r2=541022 ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductContentWrapper.java Wed May 23 11:47:11 2007 @@ -78,7 +78,11 @@ } public String get(String productContentTypeId) { - return getProductContentAsText(product, productContentTypeId, locale, mimeTypeId, product.getDelegator(), dispatcher); + if (this.product == null) { + Debug.logWarning("Tried to get ProductContent for type [" + productContentTypeId + "] but the product field in the ProductContentWrapper is null", module); + return null; + } + return getProductContentAsText(this.product, productContentTypeId, locale, mimeTypeId, this.product.getDelegator(), dispatcher); } public static String getProductContentAsText(GenericValue product, String productContentTypeId, HttpServletRequest request) { Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java?view=diff&rev=541022&r1=541021&r2=541022 ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/ups/UpsServices.java Wed May 23 11:47:11 2007 @@ -2045,7 +2045,7 @@ StringBuffer xmlString = new StringBuffer(); xmlString.append(accessRequestString); xmlString.append(rateRequestString); - Debug.logInfo(xmlString.toString(), module); + if (Debug.verboseOn()) Debug.logVerbose(xmlString.toString(), module); // send the request String rateResponseString = null; try { Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java?view=diff&rev=541022&r1=541021&r2=541022 ============================================================================== --- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java (original) +++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java Wed May 23 11:47:11 2007 @@ -81,7 +81,7 @@ if (isoCode != null && isoCode.length() > 1) { nf.setCurrency(com.ibm.icu.util.Currency.getInstance(isoCode)); } else { - Debug.logWarning("No isoCode specified to format currency value:" + price, module); + if (Debug.verboseOn()) Debug.logVerbose("No isoCode specified to format currency value:" + price, module); } if (maximumFractionDigits >= 0) { nf.setMaximumFractionDigits(maximumFractionDigits); Modified: ofbiz/trunk/framework/common/script/org/ofbiz/common/CdyneServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/script/org/ofbiz/common/CdyneServices.xml?view=diff&rev=541022&r1=541021&r2=541022 ============================================================================== --- ofbiz/trunk/framework/common/script/org/ofbiz/common/CdyneServices.xml (original) +++ ofbiz/trunk/framework/common/script/org/ofbiz/common/CdyneServices.xml Wed May 23 11:47:11 2007 @@ -22,7 +22,7 @@ xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd"> <simple-method method-name="cdynePostalAddressFillInCounty" short-description="Cdyne PostalAddress Fill In County"> <entity-one entity-name="PostalAddress" value-name="postalAddress"/> - <log level="always" message="In cdynePostalAddressFillInCounty contactMechId=${parameters.contactMechId}; postalAddress=${postalAddress}"/> + <log level="verbose" message="In cdynePostalAddressFillInCounty contactMechId=${parameters.contactMechId}; postalAddress=${postalAddress}"/> <if> <condition> <and> @@ -37,7 +37,7 @@ <call-service service-name="cdyneReturnCityState" in-map-name="cdyneReturnCityStateMap"> <results-to-map map-name="cdyneResultMap"/> </call-service> - <log level="always" message="Got result from CDyne service: ${cdyneResultMap}"/> + <log level="verbose" message="Got result from CDyne service: ${cdyneResultMap}"/> <!-- Now try to find the county based on what was returned --> <entity-condition entity-name="GeoAssocAndGeoTo" list-name="geoList"> |
Free forum by Nabble | Edit this page |