This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git The following commit(s) were added to refs/heads/trunk by this push: new 15aec7e WIP: [Improved]: Use GroovyBaseScript's logging utility methods instead of using Debug (OFBIZ-11762) (#185) 15aec7e is described below commit 15aec7e8f7f04e774bc9f956876e057c9006b9c7 Author: Priya Sharma <[hidden email]> AuthorDate: Sat Jun 6 13:47:23 2020 +0530 WIP: [Improved]: Use GroovyBaseScript's logging utility methods instead of using Debug (OFBIZ-11762) (#185) * [Improved]: Use GroovyBaseScript's logging utility methods instead of using Debug - Replaced the debug.log methods with the respective groovy utility method - Enhanced the GroovyBaseScript to entertain the fetch the current class name as the module name for logging - Overloaded the logError method to entertain throwbale object for better logging - Removed unused import statements and module variables. (OFBIZ-11762) * [Removed]: Extra line spaces. (OFBIZ-11762) * [Revert]: Unwanted changes. (OFBIZ-11762) * [Added] Same changes to these files. (OFBIZ-11762) Co-authored-by: Priya Sharma <[hidden email]> --- .../groovyScripts/invoice/InvoiceServices.groovy | 10 ++++----- .../groovyScripts/cms/CmsEditAddPrep.groovy | 7 +++---- .../groovyScripts/cms/MostRecentPrep.groovy | 7 +++---- .../content/GetContentLookupList.groovy | 9 +++----- .../content/groovyScripts/content/PrepSeqNo.groovy | 4 +--- .../survey/EditSurveyQuestions.groovy | 4 +--- .../groovyScripts/bom/BomSimulation.groovy | 3 +-- .../groovyScripts/quote/ManageQuotePrices.groovy | 4 +--- .../order/groovyScripts/quote/QuoteServices.groovy | 12 ++++------- .../groovyScripts/quote/ViewQuoteProfit.groovy | 4 +--- .../reports/OpenOrderItemsReport.groovy | 4 +--- .../CommunicationEventServices.groovy | 10 +++------ .../party/groovyScripts/party/FindLookUp.groovy | 3 +-- .../party/PartyFinancialHistory.groovy | 5 ++--- .../party/groovyScripts/visit/ShowVisits.groovy | 7 ++----- .../catalog/category/EditCategory.groovy | 6 ++---- .../config/EditProductConfigItemContent.groovy | 6 ++---- .../feature/EditFeatureCategoryFeatures.groovy | 6 ++---- .../catalog/imagemanagement/ImageUpload.groovy | 6 ++---- .../catalog/imagemanagement/SetDefaultImage.groovy | 6 ++---- .../product/ApplyFeaturesFromCategory.groovy | 6 ++---- .../catalog/product/EditProductContent.groovy | 6 ++---- .../facility/ComputeProductSellThroughData.groovy | 5 +---- .../CountFacilityInventoryByProduct.groovy | 19 ++++++++--------- .../facility/FindInventoryItemsByLabels.groovy | 4 ++-- .../facility/ViewFacilityInventoryByProduct.groovy | 11 +++++----- .../facility/inventory/InventoryItemTotals.groovy | 4 ++-- .../ReceiveInventoryAgainstPurchaseOrder.groovy | 2 +- .../promo/ProductPromoActionServices.groovy | 24 +++++++++++----------- .../product/promo/ProductPromoCondServices.groovy | 24 +++++++++++----------- .../common/groovyScripts/GroovyServiceTest.groovy | 19 ++++++++--------- .../ofbiz/service/engine/GroovyBaseScript.groovy | 16 ++++++++++----- .../artifactinfo/TestSuiteInfo.groovy | 3 +-- .../webtools/groovyScripts/entity/XmlDsDump.groovy | 2 +- .../groovyScripts/stats/StatBinsHistory.groovy | 2 +- .../org/apache/ofbiz/webtools/log/FetchLogs.groovy | 2 +- 36 files changed, 113 insertions(+), 159 deletions(-) diff --git a/applications/accounting/groovyScripts/invoice/InvoiceServices.groovy b/applications/accounting/groovyScripts/invoice/InvoiceServices.groovy index 4402e5d..306c849 100644 --- a/applications/accounting/groovyScripts/invoice/InvoiceServices.groovy +++ b/applications/accounting/groovyScripts/invoice/InvoiceServices.groovy @@ -30,7 +30,7 @@ def getNextInvoiceId() { // try to find PartyAcctgPreference for parameters.partyId, see if we need any special invoice number sequencing GenericValue partyAcctgPreference = from('PartyAcctgPreference').where(parameters).queryOne() - if (Debug.infoOn()) Debug.logInfo("In getNextInvoiceId partyId is [${parameters.partyId}], partyAcctgPreference: ${partyAcctgPreference}", 'InvoiceServices.groovy') + if (Debug.infoOn()) logInfo("In getNextInvoiceId partyId is [${parameters.partyId}], partyAcctgPreference: ${partyAcctgPreference}") String customMethodName = null; String invoiceIdPrefix = ''; @@ -50,7 +50,7 @@ def getNextInvoiceId() { } } } else { - Debug.logWarning('Acctg preference not defined for partyId [${parameters.partyId}]', 'InvoiceServices.groovy') + logWarning('Acctg preference not defined for partyId [${parameters.partyId}]') } String invoiceIdTemp = '' @@ -60,7 +60,7 @@ def getNextInvoiceId() { if (ServiceUtil.isError(serviceResult)) return serviceResult invoiceIdTemp = serviceResult.invoiceId } else { - Debug.logInfo('In createInvoice sequence enum Standard', 'InvoiceServices.groovy') + logInfo('In createInvoice sequence enum Standard') //default to the default sequencing: INVSQ_STANDARD invoiceIdTemp = parameters.invoiceId if (!invoiceIdTemp) { @@ -83,7 +83,7 @@ def getNextInvoiceId() { def invoiceSequenceEnforced() { result = success() - Debug.logInfo('In createInvoice sequence enum Enforced', 'InvoiceServices.groovy') + logInfo('In createInvoice sequence enum Enforced') GenericValue partyAcctgPreference = parameters.partyAcctgPreference //this is sequential sequencing, we can't skip a number, also it must be a unique sequence per partyIdFrom @@ -101,7 +101,7 @@ def invoiceSequenceEnforced() { def invoiceSequenceRestart() { result = success() - Debug.logInfo('In createInvoice sequence enum Enforced', 'InvoiceServices.groovy') + logInfo('In createInvoice sequence enum Enforced') GenericValue partyAcctgPreference = parameters.partyAcctgPreference //this is sequential sequencing, we can't skip a number, also it must be a unique sequence per partyIdFrom diff --git a/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy b/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy index a996a64..030c10d 100644 --- a/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy +++ b/applications/content/groovyScripts/cms/CmsEditAddPrep.groovy @@ -17,7 +17,6 @@ * under the License. */ -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.base.util.UtilDateTime import org.apache.ofbiz.base.util.UtilFormatOut import org.apache.ofbiz.content.data.DataResourceWorker @@ -30,7 +29,7 @@ contentId = context.contentId contentAssocPK = delegator.makeValue("ContentAssoc") contentAssocPK.setAllFields(context, false, "ca", new Boolean(true)) -Debug.logInfo("in cmseditaddprep, contentAssocPK:" + contentAssocPK,"") +logInfo("in cmseditaddprep, contentAssocPK:" + contentAssocPK) contentAssoc = null if (contentAssocPK.isPrimaryKey()) { @@ -43,7 +42,7 @@ if (contentAssoc) { contentAssocPK.setAllFields(context, false, "ca", null) //set all field, pk and non SimpleMapProcessor.runSimpleMapProcessor("component://content/minilang/ContentManagementMapProcessors.xml", "contentAssocOut", contentAssocPK, contentAssocDataResourceViewFrom, new ArrayList(), Locale.getDefault()) } -Debug.logInfo("in cmseditaddprep, contentAssocDataResourceViewFrom:" + contentAssocDataResourceViewFrom,"") +logInfo("in cmseditaddprep, contentAssocDataResourceViewFrom:" + contentAssocDataResourceViewFrom) dataResourceId = "" textData = "" @@ -77,7 +76,7 @@ if (dataResourceId) { textData = UtilFormatOut.encodeXmlValue(txt) } } -Debug.logInfo("in cmseditaddprep, textData:" + textData,"") +logInfo("in cmseditaddprep, textData:" + textData) currentValue = new HashMap(contentAssocDataResourceViewFrom) currentValue.textData = textData diff --git a/applications/content/groovyScripts/cms/MostRecentPrep.groovy b/applications/content/groovyScripts/cms/MostRecentPrep.groovy index 05fb017..e5d2109 100644 --- a/applications/content/groovyScripts/cms/MostRecentPrep.groovy +++ b/applications/content/groovyScripts/cms/MostRecentPrep.groovy @@ -17,7 +17,6 @@ * under the License. */ -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.base.util.UtilHttp import org.apache.ofbiz.base.util.UtilDateTime import org.apache.ofbiz.content.ContentManagementWorker @@ -25,7 +24,7 @@ import org.apache.ofbiz.entity.condition.EntityCondition import org.apache.ofbiz.entity.condition.EntityOperator -Debug.logInfo("in mostrecentprep(1):","") +logInfo("in mostrecentprep(1):") paramMap = UtilHttp.getParameterMap(request) forumId = ContentManagementWorker.getFromSomewhere("moderatedSiteId", paramMap, request, context) @@ -41,7 +40,7 @@ if (forumId) { expr = EntityCondition.makeCondition(exprList, EntityOperator.AND) entityList = from("ContentAssocViewFrom").where(exprList).orderBy("-caFromDate").queryList() - Debug.logInfo("in mostrecentprep(1), entityList.size():" + entityList.size(),"") - Debug.logInfo("in mostrecentprep(1), entityList:" + entityList,"") + logInfo("in mostrecentprep(1), entityList.size():" + entityList.size()) + logInfo("in mostrecentprep(1), entityList:" + entityList) context.mostRecentList = entityList } diff --git a/applications/content/groovyScripts/content/GetContentLookupList.groovy b/applications/content/groovyScripts/content/GetContentLookupList.groovy index fea7db0..93ce19d 100644 --- a/applications/content/groovyScripts/content/GetContentLookupList.groovy +++ b/applications/content/groovyScripts/content/GetContentLookupList.groovy @@ -18,7 +18,6 @@ */ import org.apache.ofbiz.entity.GenericEntityException -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.base.util.UtilFormatOut import org.apache.ofbiz.base.util.UtilMisc import org.apache.ofbiz.entity.transaction.TransactionUtil @@ -27,8 +26,6 @@ import org.apache.ofbiz.entity.model.ModelField import org.apache.ofbiz.entity.model.ModelEntity import org.apache.ofbiz.entity.model.ModelReader -module = "GetContentLookupList.groovy" - viewIndex = parameters.VIEW_INDEX ? Integer.valueOf(parameters.VIEW_INDEX) : 0 viewSize = parameters.VIEW_SIZE ? Integer.valueOf(parameters.VIEW_SIZE) : 20 @@ -55,7 +52,7 @@ while (fieldIterator.hasNext()) { try { findByEntity.setString(field.getName(), fval) } catch (NumberFormatException nfe) { - Debug.logError(nfe, "Caught an exception : " + nfe.toString(), module) + logError(nfe, "Caught an exception : " + nfe.toString()) errMsgList.add("Entered value is non-numeric for numeric field: " + field.getName()) } } @@ -85,12 +82,12 @@ if ((highIndex - lowIndex + 1) > 0) { highIndex = arraySize } } catch (GenericEntityException e) { - Debug.logError(e, "Failure in operation, rolling back transaction", module) + logError(e, "Failure in operation, rolling back transaction") try { // only rollback the transaction if we started one... TransactionUtil.rollback(beganTransaction, "Error looking up entity values in WebTools Entity Data Maintenance", e) } catch (GenericEntityException e2) { - Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module) + logError(e2, "Could not rollback transaction: " + e2.toString()) } // after rolling back, rethrow the exception throw e diff --git a/applications/content/groovyScripts/content/PrepSeqNo.groovy b/applications/content/groovyScripts/content/PrepSeqNo.groovy index 826bdbd..921307c 100644 --- a/applications/content/groovyScripts/content/PrepSeqNo.groovy +++ b/applications/content/groovyScripts/content/PrepSeqNo.groovy @@ -17,13 +17,11 @@ * under the License. */ -import org.apache.ofbiz.base.util.Debug - seqNo = context.caSequenceNum if (!seqNo) { seqNo = context.sequenceNum } -Debug.logInfo("caSequenceNum:" + seqNo, "") +logInfo("caSequenceNum:" + seqNo) if (seqNo) { seqNumBefore = seqNo - 1 diff --git a/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy b/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy index df2a2fb..054143c 100644 --- a/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy +++ b/applications/content/groovyScripts/survey/EditSurveyQuestions.groovy @@ -17,10 +17,8 @@ * under the License. */ -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.entity.GenericEntityException -module = "EditSurveyQuestions.groovy" surveyQuestionId = parameters.surveyQuestionId context.surveyQuestionId = surveyQuestionId @@ -58,7 +56,7 @@ try { context.highIndex = highIndex context.listSize = listSize } catch (GenericEntityException e) { - Debug.logError(e, "Failure in " + module) + logError(e, "Failure in " + module) } finally { listIt.close() } diff --git a/applications/manufacturing/groovyScripts/bom/BomSimulation.groovy b/applications/manufacturing/groovyScripts/bom/BomSimulation.groovy index b99dbe7..465fbef 100644 --- a/applications/manufacturing/groovyScripts/bom/BomSimulation.groovy +++ b/applications/manufacturing/groovyScripts/bom/BomSimulation.groovy @@ -17,7 +17,6 @@ * under the License. */ -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.manufacturing.bom.BOMNode tree = request.getAttribute("tree") @@ -59,7 +58,7 @@ if (tree) { qoh = outMap.quantityOnHandTotal } } catch (Exception e) { - Debug.logError("Error retrieving bom simulation data: " + e.getMessage(), "BomSimulation") + logError("Error retrieving bom simulation data: " + e.getMessage()) } productsData.add([node : node, unitCost : unitCost, totalCost : totalCost, qoh : qoh]) } diff --git a/applications/order/groovyScripts/quote/ManageQuotePrices.groovy b/applications/order/groovyScripts/quote/ManageQuotePrices.groovy index 865825a..e0c5544 100644 --- a/applications/order/groovyScripts/quote/ManageQuotePrices.groovy +++ b/applications/order/groovyScripts/quote/ManageQuotePrices.groovy @@ -17,8 +17,6 @@ * under the License. */ -import org.apache.ofbiz.base.util.Debug - costMult = 0.0 quoteCoefficients.each { quoteCoefficient -> value = quoteCoefficient.coeffValue @@ -60,7 +58,7 @@ quoteItems.each { quoteItem -> totalCost += (averageCost * quantity) totalPrice += (unitPrice * quantity * selectedAmount) } catch (Exception exc) { - Debug.logError("Problems getting the averageCost for quoteItem: " + quoteItem) + logError("Problems getting the averageCost for quoteItem: " + quoteItem) } quoteItemAndCostInfo = new java.util.HashMap(quoteItem) diff --git a/applications/order/groovyScripts/quote/QuoteServices.groovy b/applications/order/groovyScripts/quote/QuoteServices.groovy index a1a368d..1e5e551 100644 --- a/applications/order/groovyScripts/quote/QuoteServices.groovy +++ b/applications/order/groovyScripts/quote/QuoteServices.groovy @@ -17,7 +17,6 @@ * under the License. */ -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.base.util.UtilValidate import org.apache.ofbiz.base.util.UtilProperties import org.apache.ofbiz.base.util.UtilDateTime @@ -32,8 +31,6 @@ import org.apache.ofbiz.service.ExecutionServiceException import org.apache.ofbiz.service.ModelService import org.apache.ofbiz.service.ServiceUtil -String module = 'QuoteServices.groovy' - /** * Set the Quote status to ordered. */ @@ -53,14 +50,13 @@ def checkUpdateQuoteStatus() { def getNextQuoteId() { // Try to find PartyAcctgPreference for parameters.partyId, see if we need any special quote number sequencing GenericValue partyAcctgPreference = from('PartyAcctgPreference').where('partyId', parameters.partyId).queryOne() - Debug.logInfo("In getNextQuoteId partyId is [${parameters.partyId}], partyAcctgPreference: ${partyAcctgPreference}", - module) + logInfo("In getNextQuoteId partyId is [${parameters.partyId}], partyAcctgPreference: ${partyAcctgPreference}") Map customMethod = null if (partyAcctgPreference) { customMethod = partyAcctgPreference.getRelatedOne('QuoteCustomMethod', false) } else { - Debug.logWarning("Acctg preference not defined for partyId [${parameters.partyId}]", module) + logWarning("Acctg preference not defined for partyId [${parameters.partyId}]") } String customMethodName @@ -108,7 +104,7 @@ def getNextQuoteId() { * Enforced Sequence (no gaps, per organization). */ def quoteSequenceEnforced() { - Debug.logInfo('In getNextQuoteId sequence enum Enforced', module) + logInfo('In getNextQuoteId sequence enum Enforced') GenericValue partyAcctgPreference = parameters.partyAcctgPreference // This is sequential sequencing, we can't skip a number, also it must be a unique sequence per partyIdFrom @@ -192,7 +188,7 @@ def updateQuote() { GenericValue validChange = from("StatusValidChange").where('statusId', quote.statusId, 'statusIdTo', parameters.statusId).queryOne() if (!validChange) { - Debug.logError("The status change from ${quote.statusId} to ${parameters.statusId} is not a valid change", module) + logError("The status change from ${quote.statusId} to ${parameters.statusId} is not a valid change") // FIXME : LABEL :D return error(UtilProperties.getMessage('OrderErrorUiLabels', 'OrderQuoteStatusChangeIsNotValid', locale)) } diff --git a/applications/order/groovyScripts/quote/ViewQuoteProfit.groovy b/applications/order/groovyScripts/quote/ViewQuoteProfit.groovy index efeb5bd..7d80f5f 100644 --- a/applications/order/groovyScripts/quote/ViewQuoteProfit.groovy +++ b/applications/order/groovyScripts/quote/ViewQuoteProfit.groovy @@ -17,8 +17,6 @@ * under the License. */ -import org.apache.ofbiz.base.util.Debug - costMult = 0.0 quoteCoefficients.each { quoteCoefficient -> value = quoteCoefficient.coeffValue @@ -60,7 +58,7 @@ quoteItems.each { quoteItem -> totalCost += (averageCost * quantity) totalPrice += (unitPrice * quantity * selectedAmount) } catch (Exception exc) { - Debug.logError("Problems getting the averageCost for quoteItem: " + quoteItem) + logError("Problems getting the averageCost for quoteItem: " + quoteItem) } profit = unitPrice - averageCost percProfit = averageCost != 0 ? (profit / unitPrice) * 100.00 : 0.00 diff --git a/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy b/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy index aee492b..911e5a4 100644 --- a/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy +++ b/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy @@ -26,10 +26,8 @@ import org.apache.ofbiz.entity.condition.EntityCondition import org.apache.ofbiz.entity.condition.EntityOperator import org.apache.ofbiz.entity.GenericEntityException -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.base.util.ObjectType -module = "OpenOrderItemsReport.groovy" productStoreId = ObjectType.simpleTypeOrObjectConvert(parameters.productStoreId, "List", null, null) orderTypeId = ObjectType.simpleTypeOrObjectConvert(parameters.orderTypeId, "List", null, null) orderStatusId = ObjectType.simpleTypeOrObjectConvert(parameters.orderStatusId, "List", null, null) @@ -144,7 +142,7 @@ try { orderItemList.add(orderItemMap) } } catch (GenericEntityException e) { - Debug.logError(e, "Failure in " + module) + logError(e, "Failure in " + module) } finally { listIt.close() } diff --git a/applications/party/groovyScripts/communication/CommunicationEventServices.groovy b/applications/party/groovyScripts/communication/CommunicationEventServices.groovy index 17990bf..dffed1c 100644 --- a/applications/party/groovyScripts/communication/CommunicationEventServices.groovy +++ b/applications/party/groovyScripts/communication/CommunicationEventServices.groovy @@ -17,7 +17,6 @@ * under the License. */ -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.base.util.UtilDateTime import org.apache.ofbiz.base.util.UtilProperties import org.apache.ofbiz.entity.GenericValue @@ -381,8 +380,7 @@ def deleteCommunicationEventWorkEffort() { List<GenericValue> otherComs = workEffort.getRelated("CommunicationEventWorkEff", null, null, false) if (!otherComs) { - Debug.logInfo("remove workeffort ${workEffort.workEffortId} and related parties and status", - "CommunicationEventService.groovy") + logInfo("remove workeffort ${workEffort.workEffortId} and related parties and status") workEffort.removeRelated("WorkEffortPartyAssignment") workEffort.removeRelated("WorkEffortStatus") workEffort.removeRelated("WorkEffortKeyword") @@ -536,8 +534,7 @@ def setCommunicationEventStatus() { statusIdTo: parameters.statusId) .queryOne() if (!statusChange) { - Debug.logError("Cannot change from ${communicationEventRole.statusId} to ${parameters.statusId}", - "CommunicationEventServices.groovy") + logError("Cannot change from ${communicationEventRole.statusId} to ${parameters.statusId}") return error(UtilProperties.getMessage("ProductUiLabels", "commeventservices.communication_event_status", parameters.locale as Locale)) } else { @@ -624,8 +621,7 @@ def setCommunicationEventRoleStatus() { .cache() .queryOne() if (!statusChange) { - Debug.logError("Cannot change from ${communicationEventRole.statusId} to ${parameters.statusId}", - "CommunicationEventServices.groovy") + logError("Cannot change from ${communicationEventRole.statusId} to ${parameters.statusId}") return error(UtilProperties.getMessage("ProductUiLabels", "commeventservices.communication_event_status", parameters.locale as Locale)) } else { diff --git a/applications/party/groovyScripts/party/FindLookUp.groovy b/applications/party/groovyScripts/party/FindLookUp.groovy index 2c9df06..7a1b3d1 100644 --- a/applications/party/groovyScripts/party/FindLookUp.groovy +++ b/applications/party/groovyScripts/party/FindLookUp.groovy @@ -20,7 +20,6 @@ -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.entity.condition.EntityCondition import org.apache.ofbiz.entity.condition.EntityOperator import org.apache.ofbiz.entity.util.EntityUtilProperties @@ -57,7 +56,7 @@ executeResult = runService('executeFind', [entityName : context.entityName, entityConditionList : entityConditionList, noConditionFind : context.noConditionFind]) if (executeResult.listIt == null) { - Debug.logWarning("No list found for query string + [" + prepareResult.queryString + "]", "FindLookUp.groovy") + logWarning("No list found for query string + [" + prepareResult.queryString + "]") } context.listIt = executeResult.listIt context.queryString = prepareResult.queryString diff --git a/applications/party/groovyScripts/party/PartyFinancialHistory.groovy b/applications/party/groovyScripts/party/PartyFinancialHistory.groovy index 8226449..b6107f2 100644 --- a/applications/party/groovyScripts/party/PartyFinancialHistory.groovy +++ b/applications/party/groovyScripts/party/PartyFinancialHistory.groovy @@ -17,7 +17,6 @@ * under the License. */ -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.accounting.invoice.InvoiceWorker import org.apache.ofbiz.accounting.payment.PaymentWorker import org.apache.ofbiz.entity.condition.EntityCondition @@ -69,7 +68,7 @@ while (invoice = invIterator.next()) { totalInvSaNotApplied += InvoiceWorker.getInvoiceNotApplied(invoice, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP) } else { - Debug.logError("InvoiceType: " + invoice.invoiceTypeId + " without a valid parentTypeId: " + invoice.parentTypeId + " !!!! Should be either PURCHASE_INVOICE or SALES_INVOICE", "") + logError("InvoiceType: " + invoice.invoiceTypeId + " without a valid parentTypeId: " + invoice.parentTypeId + " !!!! Should be either PURCHASE_INVOICE or SALES_INVOICE") } } @@ -109,7 +108,7 @@ while (payment = payIterator.next()) { totalPayInNotApplied += PaymentWorker.getPaymentNotApplied(payment, actualCurrency).setScale(2,BigDecimal.ROUND_HALF_UP) } else { - Debug.logError("PaymentTypeId: " + payment.paymentTypeId + " without a valid parentTypeId: " + payment.parentTypeId + " !!!! Should be either DISBURSEMENT, TAX_PAYMENT or RECEIPT", "") + logError("PaymentTypeId: " + payment.paymentTypeId + " without a valid parentTypeId: " + payment.parentTypeId + " !!!! Should be either DISBURSEMENT, TAX_PAYMENT or RECEIPT") } } payIterator.close() diff --git a/applications/party/groovyScripts/visit/ShowVisits.groovy b/applications/party/groovyScripts/visit/ShowVisits.groovy index 7f473f3..8a9a285 100644 --- a/applications/party/groovyScripts/visit/ShowVisits.groovy +++ b/applications/party/groovyScripts/visit/ShowVisits.groovy @@ -18,11 +18,8 @@ */ import org.apache.ofbiz.entity.transaction.TransactionUtil -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.entity.util.EntityUtilProperties -module = "showvisits.groovy" - partyId = parameters.partyId context.partyId = partyId @@ -72,12 +69,12 @@ try { } catch (Exception e) { String errMsg = "Failure in operation, rolling back transaction" - Debug.logError(e, errMsg, module) + logError(e, errMsg) try { // only rollback the transaction if we started one... TransactionUtil.rollback(beganTransaction, errMsg, e) } catch (Exception e2) { - Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module) + logError(e2, "Could not rollback transaction: " + e2.toString()) } // after rolling back, rethrow the exception throw e diff --git a/applications/product/groovyScripts/catalog/category/EditCategory.groovy b/applications/product/groovyScripts/catalog/category/EditCategory.groovy index 7d8edd0..47d690f 100644 --- a/applications/product/groovyScripts/catalog/category/EditCategory.groovy +++ b/applications/product/groovyScripts/catalog/category/EditCategory.groovy @@ -21,8 +21,6 @@ import org.apache.ofbiz.base.util.* import org.apache.ofbiz.base.util.string.* import org.apache.ofbiz.entity.util.EntityUtilProperties -module = "EditCategory.groovy" - if (productCategory) { context.productCategoryType = productCategory.getRelatedOne("ProductCategoryType", false) } @@ -106,11 +104,11 @@ if (fileType) { try { file1.delete() } catch (Exception e) { - Debug.logError(e, "error deleting existing file (not neccessarily a problem)", module) + logError(e, "error deleting existing file (not neccessarily a problem)") } file.renameTo(file1) } catch (Exception e) { - Debug.logError(e, module) + logError(e, module) } if (imageUrl) { diff --git a/applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy b/applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy index f2f9a02..034be19 100644 --- a/applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy +++ b/applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy @@ -22,8 +22,6 @@ import org.apache.ofbiz.base.util.string.* import org.apache.ofbiz.entity.* import org.apache.ofbiz.entity.util.EntityUtilProperties -module = "EditProductConfigItemContent.groovy" - // make the image file formats context.tenantId = delegator.getDelegatorTenantId() imageFilenameFormat = "configitems/${configItemId}" @@ -116,11 +114,11 @@ if (fileType) { try { file1.delete() } catch (Exception e) { - Debug.logError(e, "error deleting existing file (not neccessarily a problem)", module) + logError(e, "error deleting existing file (not neccessarily a problem)") } file.renameTo(file1) } catch (Exception e) { - Debug.logError(e, module) + logError(e, module) } if (imageUrl) { diff --git a/applications/product/groovyScripts/catalog/feature/EditFeatureCategoryFeatures.groovy b/applications/product/groovyScripts/catalog/feature/EditFeatureCategoryFeatures.groovy index 94d2958..7fbfe38 100644 --- a/applications/product/groovyScripts/catalog/feature/EditFeatureCategoryFeatures.groovy +++ b/applications/product/groovyScripts/catalog/feature/EditFeatureCategoryFeatures.groovy @@ -23,8 +23,6 @@ import org.apache.ofbiz.entity.util.EntityFindOptions import org.apache.ofbiz.base.util.* import org.apache.ofbiz.entity.transaction.* -module = "EditFeatureCategoryFeatures.groovy" - context.hasPermission = security.hasEntityPermission("CATALOG", "_VIEW", session) context.nowTimestampString = UtilDateTime.nowTimestamp().toString() @@ -81,12 +79,12 @@ try { productFeaturesEli.close() } catch (GenericEntityException e) { String errMsg = "Failure in operation, rolling back transaction" - Debug.logError(e, errMsg, module) + logError(e, errMsg) try { // only rollback the transaction if we started one... TransactionUtil.rollback(beganTransaction, errMsg, e) } catch (GenericEntityException e2) { - Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module) + logError(e2, "Could not rollback transaction: " + e2.toString()) } // after rolling back, rethrow the exception throw e diff --git a/applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy b/applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy index 6a348fd..6a18c67 100644 --- a/applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy +++ b/applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy @@ -24,8 +24,6 @@ import org.apache.ofbiz.entity.util.EntityUtilProperties import org.apache.ofbiz.product.image.ScaleImage import org.apache.ofbiz.entity.condition.* -module = "ImageUpload.groovy" - context.nowTimestampString = UtilDateTime.nowTimestamp().toString() // make the image file formats @@ -119,11 +117,11 @@ if (fileType) { try { file1.delete() } catch (Exception e) { - Debug.logError(e, "error deleting existing file (not neccessarily a problem)", module) + logError(e, "error deleting existing file (not neccessarily a problem)") } file.renameTo(file1) } catch (Exception e) { - Debug.logError(e, module) + logError(e, module) } if (imageUrl && imageUrl.length() > 0) { diff --git a/applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy b/applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy index 85fda41..446e74c 100644 --- a/applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy +++ b/applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy @@ -31,8 +31,6 @@ import org.apache.ofbiz.base.util.* import org.apache.ofbiz.base.util.string.* import org.apache.ofbiz.product.image.ScaleImage -module = "SetDefaultImage.groovy" - context.nowTimestampString = UtilDateTime.nowTimestamp().toString() imageManagementPath = FlexibleStringExpander.expandString(EntityUtilProperties.getPropertyValue("catalog", "image.management.path", delegator), context) @@ -157,11 +155,11 @@ if (fileType) { } } } catch (Exception e) { - Debug.logError(e, "error deleting existing file (not neccessarily a problem)", module) + logError(e, "error deleting existing file (not neccessarily a problem)") } file.renameTo(file1) } catch (Exception e) { - Debug.logError(e, module) + logError(e, module) } if (imageUrl && imageUrl.length() > 0) { diff --git a/applications/product/groovyScripts/catalog/product/ApplyFeaturesFromCategory.groovy b/applications/product/groovyScripts/catalog/product/ApplyFeaturesFromCategory.groovy index 4d07781..bc1061e 100644 --- a/applications/product/groovyScripts/catalog/product/ApplyFeaturesFromCategory.groovy +++ b/applications/product/groovyScripts/catalog/product/ApplyFeaturesFromCategory.groovy @@ -23,8 +23,6 @@ import org.apache.ofbiz.entity.util.EntityFindOptions import org.apache.ofbiz.entity.transaction.* import org.apache.ofbiz.base.util.* -module = "ApplyFeaturesFromCategory.groovy" - context.nowTimestampString = UtilDateTime.nowTimestamp().toString() productFeatureCategoryId = request.getParameter("productFeatureCategoryId") @@ -79,12 +77,12 @@ try { productFeaturesEli.close() } catch (GenericEntityException e) { String errMsg = "Failure in operation, rolling back transaction" - Debug.logError(e, errMsg, module) + logError(e, errMsg) try { // only rollback the transaction if we started one... TransactionUtil.rollback(beganTransaction, errMsg, e) } catch (GenericEntityException e2) { - Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module) + logError(e2, "Could not rollback transaction: " + e2.toString()) } // after rolling back, rethrow the exception throw e diff --git a/applications/product/groovyScripts/catalog/product/EditProductContent.groovy b/applications/product/groovyScripts/catalog/product/EditProductContent.groovy index 8c3873e..71f3c0c 100644 --- a/applications/product/groovyScripts/catalog/product/EditProductContent.groovy +++ b/applications/product/groovyScripts/catalog/product/EditProductContent.groovy @@ -23,8 +23,6 @@ import org.apache.ofbiz.base.util.string.* import org.apache.ofbiz.entity.util.EntityUtilProperties import org.apache.ofbiz.product.image.ScaleImage -module = "EditProductContent.groovy" - context.nowTimestampString = UtilDateTime.nowTimestamp().toString() // make the image file formats @@ -136,11 +134,11 @@ if (fileType) { } } } catch (Exception e) { - Debug.logError(e, "error deleting existing file (not neccessarily a problem)", module) + logError(e, "error deleting existing file (not neccessarily a problem)") } file.renameTo(file1) } catch (Exception e) { - Debug.logError(e, module) + logError(e, module) } if (imageUrl && imageUrl.length() > 0) { diff --git a/applications/product/groovyScripts/facility/facility/ComputeProductSellThroughData.groovy b/applications/product/groovyScripts/facility/facility/ComputeProductSellThroughData.groovy index 06ebd69..f447103 100644 --- a/applications/product/groovyScripts/facility/facility/ComputeProductSellThroughData.groovy +++ b/applications/product/groovyScripts/facility/facility/ComputeProductSellThroughData.groovy @@ -20,9 +20,6 @@ import java.math.MathContext import java.sql.Timestamp -import org.apache.ofbiz.base.util.Debug - - if (parameters.fromDateSellThrough) { Timestamp fromDate = null Timestamp thruDate = null @@ -30,7 +27,7 @@ if (parameters.fromDateSellThrough) { fromDate = Timestamp.valueOf(parameters.fromDateSellThrough) thruDate = Timestamp.valueOf(parameters.thruDateSellThrough) } catch (Exception e) { - Debug.logError(e, "ComputeProductSellThroughData.groovy"); + logError(e, module) } inventoryCountResult = runService('countProductInventoryOnHand', [productId : productId, facilityId : facilityId, inventoryCountDate : fromDate, userLogin : userLogin]) if (inventoryCountResult.quantityOnHandTotal && inventoryCountResult.quantityOnHandTotal > 0) { diff --git a/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy b/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy index 5962ff8..5a97915 100644 --- a/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy +++ b/applications/product/groovyScripts/facility/facility/CountFacilityInventoryByProduct.groovy @@ -30,7 +30,6 @@ // is not computed; you can use the ViewFacilityInventoryByProduct.groovy if you // need it (but it is slower than this one). -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.entity.* import org.apache.ofbiz.entity.condition.* import org.apache.ofbiz.entity.transaction.* @@ -41,8 +40,6 @@ import org.apache.ofbiz.entity.model.ModelViewEntity.ComplexAlias import org.apache.ofbiz.entity.model.ModelViewEntity.ComplexAliasField import org.apache.ofbiz.product.inventory.* -module = "CountFacilityInventoryByProduct" - action = request.getParameter("action") searchParameterString = "action=Y&facilityId=" + facilityId @@ -68,7 +65,7 @@ if (action) { hasOffsetQOH = true searchParameterString = searchParameterString + "&offsetQOHQty=" + offsetQOH } catch (NumberFormatException nfe) { - Debug.logError(nfe, "Caught an exception : " + nfe.toString(), module) + logError(nfe, "Caught an exception : " + nfe.toString()) request.setAttribute("_ERROR_MESSAGE", "An entered value seems non-numeric") } } @@ -78,7 +75,7 @@ if (action) { hasOffsetATP = true searchParameterString = searchParameterString + "&offsetATPQty=" + offsetATP } catch (NumberFormatException nfe) { - Debug.logError(nfe, "Caught an exception : " + nfe.toString(), module) + logError(nfe, "Caught an exception : " + nfe.toString()) request.setAttribute("_ERROR_MESSAGE", "An entered value seems non-numeric") } } @@ -181,7 +178,7 @@ if (action) { checkTime = UtilDateTime.toTimestamp(cal.getTime()) searchParameterString += "&monthsInPastLimit=" + monthsInPastLimitStr } catch (Exception e) { - Debug.logError(e, "Caught an exception : " + e.toString(), module) + logError(e, "Caught an exception : " + e.toString()) request.setAttribute("_ERROR_MESSAGE", "An exception occured please check the log") } } @@ -279,7 +276,7 @@ if (action) { try { salesUsageQuantity += salesUsageItem.getDouble("quantity").doubleValue() } catch (Exception e) { - Debug.logError(e, "Caught an exception : " + e.toString(), module) + logError(e, "Caught an exception : " + e.toString()) request.setAttribute("_ERROR_MESSAGE", "An exception occured please check the log") } } @@ -301,7 +298,7 @@ if (action) { try { productionUsageQuantity += productionUsageItem.getDouble("quantity").doubleValue() } catch (Exception e) { - Debug.logError(e, "Caught an exception : " + e.toString(), module) + logError(e, "Caught an exception : " + e.toString()) request.setAttribute("_ERROR_MESSAGE", "An exception occured please check the log") } } @@ -347,12 +344,12 @@ if (action) { } catch (GenericEntityException e) { errMsg = "Failure in operation, rolling back transaction" - Debug.logError(e, errMsg, module) + logError(e, errMsg) try { // only rollback the transaction if we started one... TransactionUtil.rollback(beganTransaction, errMsg, e) } catch (GenericEntityException e2) { - Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module) + logError(e2, "Could not rollback transaction: " + e2.toString()) } // after rolling back, rethrow the exception throw e @@ -361,7 +358,7 @@ if (action) { try { prodsEli.close() } catch (Exception exc) { - Debug.logError(exception, module); + logError(exc, module) } } // only commit the transaction if we started one... this will throw an exception if it fails diff --git a/applications/product/groovyScripts/facility/facility/FindInventoryItemsByLabels.groovy b/applications/product/groovyScripts/facility/facility/FindInventoryItemsByLabels.groovy index 6e067bd..603f956 100644 --- a/applications/product/groovyScripts/facility/facility/FindInventoryItemsByLabels.groovy +++ b/applications/product/groovyScripts/facility/facility/FindInventoryItemsByLabels.groovy @@ -83,12 +83,12 @@ if (andCondition.size() > 1) { inventoryItemsEli.close() } catch (GenericEntityException e) { errMsg = "Failure in operation, rolling back transaction" - Debug.logError(e, errMsg, "findInventoryItemsByLabels") + logError(e, errMsg) try { // only rollback the transaction if we started one... TransactionUtil.rollback(beganTransaction, errMsg, e) } catch (GenericEntityException e2) { - Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "findInventoryItemsByLabels") + logError(e2, "Could not rollback transaction: " + e2.toString()) } // after rolling back, rethrow the exception throw e diff --git a/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy b/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy index b5a3b03..e3994ba 100644 --- a/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy +++ b/applications/product/groovyScripts/facility/facility/ViewFacilityInventoryByProduct.groovy @@ -28,7 +28,6 @@ import org.apache.ofbiz.entity.model.ModelKeyMap import org.apache.ofbiz.entity.util.EntityFindOptions import org.apache.ofbiz.product.inventory.* -module = "ViewFacilityInventoryByProduct" action = request.getParameter("action") statusId = request.getParameter("statusId") searchParameterString = "" @@ -53,7 +52,7 @@ if (action) { hasOffsetQOH = true searchParameterString = searchParameterString + "&offsetQOHQty=" + offsetQOH } catch (NumberFormatException nfe) { - Debug.logError(nfe, "Caught an exception : " + nfe.toString(), module) + logError(nfe, "Caught an exception : " + nfe.toString()) request.setAttribute("_ERROR_MESSAGE", "An entered value seems non-numeric") } } @@ -63,7 +62,7 @@ if (action) { hasOffsetATP = true searchParameterString = searchParameterString + "&offsetATPQty=" + offsetATP } catch (NumberFormatException nfe) { - Debug.logError(nfe, "Caught an exception : " + nfe.toString(), module) + logError(nfe, "Caught an exception : " + nfe.toString()) request.setAttribute("_ERROR_MESSAGE", "An entered value seems non-numeric") } } @@ -149,12 +148,12 @@ if (action) { prodsEli.close() } catch (GenericEntityException e) { errMsg = "Failure in operation, rolling back transaction" - Debug.logError(e, errMsg, module) + logError(e, errMsg) try { // only rollback the transaction if we started one... TransactionUtil.rollback(beganTransaction, errMsg, e) } catch (GenericEntityException e2) { - Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), module) + logError(e2, "Could not rollback transaction: " + e2.toString()) } // after rolling back, rethrow the exception throw e @@ -174,7 +173,7 @@ if (action) { checkTime = UtilDateTime.toTimestamp(cal.getTime()) searchParameterString += "&monthsInPastLimit=" + monthsInPastLimitStr } catch (Exception e) { - Debug.logError(e, "Caught an exception : " + e.toString(), module) + logError(e, "Caught an exception : " + e.toString()) request.setAttribute("_ERROR_MESSAGE", "An exception occured please check the log") } } diff --git a/applications/product/groovyScripts/facility/inventory/InventoryItemTotals.groovy b/applications/product/groovyScripts/facility/inventory/InventoryItemTotals.groovy index 6432617..af750f7 100644 --- a/applications/product/groovyScripts/facility/inventory/InventoryItemTotals.groovy +++ b/applications/product/groovyScripts/facility/inventory/InventoryItemTotals.groovy @@ -87,12 +87,12 @@ if (action) { invItemListItr.close() } catch (GenericEntityException e) { errMsg = "Failure in operation, rolling back transaction" - Debug.logError(e, errMsg, "findInventoryItemsByLabels") + logError(e, errMsg) try { // only rollback the transaction if we started one... TransactionUtil.rollback(beganTransaction, errMsg, e) } catch (GenericEntityException e2) { - Debug.logError(e2, "Could not rollback transaction: " + e2.toString(), "findInventoryItemsByLabels") + logError(e2, "Could not rollback transaction: " + e2.toString()) } // after rolling back, rethrow the exception throw e diff --git a/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy b/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy index 51fda51..70ef30e 100644 --- a/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy +++ b/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy @@ -217,7 +217,7 @@ if (productIdToReceive) { try { quantity = Double.parseDouble(productQtyToReceive) } catch (NumberFormatException nfe) { - Debug.logError(nfe, "Caught an exception : " + nfe.toString(), module) + logError(nfe, "Caught an exception : " + nfe.toString()) request.setAttribute("_ERROR_MESSAGE", "The quantity to update seems non-numeric") return } diff --git a/applications/product/groovyScripts/product/promo/ProductPromoActionServices.groovy b/applications/product/groovyScripts/product/promo/ProductPromoActionServices.groovy index 9711668..a8d4312 100644 --- a/applications/product/groovyScripts/product/promo/ProductPromoActionServices.groovy +++ b/applications/product/groovyScripts/product/promo/ProductPromoActionServices.groovy @@ -54,7 +54,7 @@ def productGWP() { Integer itemLoc = ProductPromoWorker.findPromoItem(productPromoAction, cart) if (!allowMultipleGwp && itemLoc != null) { if (Debug.verboseOn()) { - Debug.logVerbose("Not adding promo item, already there action: " + productPromoAction, "ProductPromoActionServices.groovy") + logVerbose("Not adding promo item, already there action: " + productPromoAction) } actionResultInfo.ranAction = false } else { @@ -83,7 +83,7 @@ def productGWP() { product = from("Product").where("productId", productId).cache().queryOne() if (product == null) { String errMsg = "GWP Product not found with ID [" + productId + "] for ProductPromoAction [" + productPromoAction.get("productPromoId") + ":" + productPromoAction.get("productPromoRuleId") + ":" + productPromoAction.get("productPromoActionSeqId") + "]" - Debug.logError(errMsg, "ProductPromoActionServices.groovy") + logError(errMsg) throw new CartItemModifyException(errMsg) } if ("Y" == product.getString("isVirtual")) { @@ -105,16 +105,16 @@ def productGWP() { } Map<String, Object> invReqResult = dispatcher.runSync("isStoreInventoryAvailable", UtilMisc.<String, Object> toMap("productStoreId", productStoreId, "productId", productId, "product", product, "quantity", quantity.add(quantityAlreadyInCart))) if (ServiceUtil.isError(invReqResult)) { - Debug.logError("Error calling isStoreInventoryAvailable service, result is: " + invReqResult, "ProductPromoActionServices.groovy") + logError("Error calling isStoreInventoryAvailable service, result is: " + invReqResult) throw new CartItemModifyException(ServiceUtil.getErrorMessage(invReqResult)) } else if ("Y" != invReqResult.get("available")) { - Debug.logWarning(UtilProperties.getMessage(resource_error, "OrderNotApplyingGwpBecauseProductIdIsOutOfStockForProductPromoAction", UtilMisc.toMap("productId", productId, "productPromoAction", productPromoAction), cart.getLocale()), "ProductPromoActionServices.groovy") + logWarning(UtilProperties.getMessage(resource_error, "OrderNotApplyingGwpBecauseProductIdIsOutOfStockForProductPromoAction", UtilMisc.toMap("productId", productId, "productPromoAction", productPromoAction), cart.getLocale())) productId = null product = null } } catch (GenericServiceException e) { String errMsg = "Fatal error calling inventory checking services: " + e.toString() - Debug.logError(e, errMsg, "ProductPromoActionServices.groovy") + logError(e, errMsg) throw new CartItemModifyException(errMsg) } } @@ -139,14 +139,14 @@ def productGWP() { Map<String, Object> invReqResult = dispatcher.runSync("isStoreInventoryAvailable", UtilMisc.<String, Object> toMap("productStoreId", productStoreId, "productId", optionProductId, "product", product, "quantity", quantity.add(quantityAlreadyInCart))) if (ServiceUtil.isError(invReqResult)) { - Debug.logError("Error calling isStoreInventoryAvailable service, result is: " + invReqResult, "ProductPromoActionServices.groovy") + logError("Error calling isStoreInventoryAvailable service, result is: " + invReqResult) throw new CartItemModifyException(ServiceUtil.getErrorMessage(invReqResult)) } else if ("Y" != invReqResult.get("available")) { optionProductIdIter.remove() } } catch (GenericServiceException e) { String errMsg = "Fatal error calling inventory checking services: " + e.toString() - Debug.logError(e, errMsg, "ProductPromoActionServices.groovy") + logError(e, errMsg) throw new CartItemModifyException(errMsg) } } @@ -163,7 +163,7 @@ def productGWP() { productId = alternateGwpProductId product = from("Product").where("productId", productId).cache().queryOne() } else { - Debug.logWarning(UtilProperties.getMessage(resource_error, "OrderAnAlternateGwpProductIdWasInPlaceButWasEitherNotValidOrIsNoLongerInStockForId", UtilMisc.toMap("alternateGwpProductId", alternateGwpProductId), cart.getLocale()), "ProductPromoActionServices.groovy") + logWarning(UtilProperties.getMessage(resource_error, "OrderAnAlternateGwpProductIdWasInPlaceButWasEitherNotValidOrIsNoLongerInStockForId", UtilMisc.toMap("alternateGwpProductId", alternateGwpProductId), cart.getLocale())) } } @@ -191,7 +191,7 @@ def productGWP() { gwpItem.setAlternativeOptionProductIds(null) } } catch (CartItemModifyException e) { - Debug.logError(e.getMessage(), "ProductPromoActionServices.groovy") + logError(e.getMessage()) throw e } @@ -201,7 +201,7 @@ def productGWP() { // set promo after create note that to setQuantity we must clear this flag, setQuantity, then re-set the flag gwpItem.setIsPromo(true) if (Debug.verboseOn()) { - Debug.logVerbose("gwpItem adjustments: " + gwpItem.getAdjustments(), "ProductPromoActionServices.groovy") + logVerbose("gwpItem adjustments: " + gwpItem.getAdjustments()) } actionResultInfo.ranAction = true @@ -284,7 +284,7 @@ def productDISC() { } else { BigDecimal totalAmount = ProductPromoWorker.getCartItemsUsedTotalAmount(cart, productPromoAction) if (Debug.verboseOn()) { - Debug.logVerbose("Applying promo [" + productPromoAction.getPrimaryKey() + "]\n totalAmount=" + totalAmount + ", discountAmountTotal=" + discountAmountTotal, "ProductPromoActionServices.groovy") + logVerbose("Applying promo [" + productPromoAction.getPrimaryKey() + "]\n totalAmount=" + totalAmount + ", discountAmountTotal=" + discountAmountTotal) } ProductPromoWorker.distributeDiscountAmount(discountAmountTotal, totalAmount, ProductPromoWorker.getCartItemsUsed(cart, productPromoAction), productPromoAction, delegator) actionResultInfo.ranAction = true @@ -345,7 +345,7 @@ def productAMDISC() { } else { BigDecimal totalAmount = ProductPromoWorker.getCartItemsUsedTotalAmount(cart, productPromoAction) if (Debug.verboseOn()) { - Debug.logVerbose("Applying promo [" + productPromoAction.getPrimaryKey() + "]\n totalAmount=" + totalAmount + ", discountAmountTotal=" + discountAmountTotal, "ProductPromoActionServices.groovy") + logVerbose("Applying promo [" + productPromoAction.getPrimaryKey() + "]\n totalAmount=" + totalAmount + ", discountAmountTotal=" + discountAmountTotal) } ProductPromoWorker.distributeDiscountAmount(discountAmountTotal, totalAmount, ProductPromoWorker.getCartItemsUsed(cart, productPromoAction), productPromoAction, delegator) actionResultInfo.ranAction = true diff --git a/applications/product/groovyScripts/product/promo/ProductPromoCondServices.groovy b/applications/product/groovyScripts/product/promo/ProductPromoCondServices.groovy index 2e3e681..a3ec0ce 100644 --- a/applications/product/groovyScripts/product/promo/ProductPromoCondServices.groovy +++ b/applications/product/groovyScripts/product/promo/ProductPromoCondServices.groovy @@ -364,7 +364,7 @@ def productOrderTotal() { if (condValue) { BigDecimal orderSubTotal = cart.getSubTotalForPromotions() - if (Debug.infoOn()) Debug.logInfo("Doing order total compare: orderSubTotal=" + orderSubTotal, module) + if (Debug.infoOn()) logInfo("Doing order total compare: orderSubTotal=" + orderSubTotal) compareBase = orderSubTotal.compareTo(new BigDecimal(condValue)) } result.compareBase = Integer.valueOf(compareBase) @@ -398,16 +398,16 @@ def productOrderHist() { try { Map<String, Object> serviceResult = run service: "getOrderedSummaryInformation", with: serviceIn if (ServiceUtil.isError(serviceResult)) { - Debug.logError("Error calling getOrderedSummaryInformation service for the PPIP_ORST_HIST ProductPromo condition input value: " + ServiceUtil.getErrorMessage(result), module) + logError("Error calling getOrderedSummaryInformation service for the PPIP_ORST_HIST ProductPromo condition input value: " + ServiceUtil.getErrorMessage(result)) return serviceResult } else { BigDecimal orderSubTotal = (BigDecimal) serviceResult.get("totalSubRemainingAmount") BigDecimal orderSubTotalAndCartSubTotal = orderSubTotal.add(cart.getSubTotal()) - if (Debug.verboseOn()) Debug.logVerbose("Doing order history sub-total compare: orderSubTotal=" + orderSubTotal + ", for the last " + monthsToInclude + " months.", module) + if (Debug.verboseOn()) logVerbose("Doing order history sub-total compare: orderSubTotal=" + orderSubTotal + ", for the last " + monthsToInclude + " months.") compareBase = orderSubTotalAndCartSubTotal.compareTo(new BigDecimal(condValue)) } } catch (GenericServiceException e) { - Debug.logError(e, "Error getting order history sub-total in the getOrderedSummaryInformation service, evaluating condition to false.", module) + logError(e, "Error getting order history sub-total in the getOrderedSummaryInformation service, evaluating condition to false.") return ServiceUtil.returnError("Error getting order history") } } @@ -444,16 +444,16 @@ def productOrderYear() { try { Map<String, Object> serviceResult = dispatcher.runSync("getOrderedSummaryInformation", serviceIn) if (ServiceUtil.isError(result)) { - Debug.logError("Error calling getOrderedSummaryInformation service for the PPIP_ORST_YEAR ProductPromo condition input value: " + ServiceUtil.getErrorMessage(result), module) + logError("Error calling getOrderedSummaryInformation service for the PPIP_ORST_YEAR ProductPromo condition input value: " + ServiceUtil.getErrorMessage(result)) return serviceResult } else { BigDecimal orderSubTotal = (BigDecimal) result.get("totalSubRemainingAmount") - if (Debug.verboseOn()) Debug.logVerbose("Doing order history sub-total compare: orderSubTotal=" + orderSubTotal + ", for the last " + monthsToInclude + " months.", module) + if (Debug.verboseOn()) logVerbose("Doing order history sub-total compare: orderSubTotal=" + orderSubTotal + ", for the last " + monthsToInclude + " months.") compareBase = orderSubTotal.compareTo(new BigDecimal((condValue))) } } catch (GenericServiceException e) { - Debug.logError(e, "Error getting order history sub-total in the getOrderedSummaryInformation service, evaluating condition to false.", module) + logError(e, "Error getting order history sub-total in the getOrderedSummaryInformation service, evaluating condition to false.") return ServiceUtil.returnError("Error getting order history") } } @@ -498,15 +498,15 @@ def productOrderLastYear() { try { Map<String, Object> serviceResult = dispatcher.runSync("getOrderedSummaryInformation", serviceIn) if (ServiceUtil.isError(serviceResult)) { - Debug.logError("Error calling getOrderedSummaryInformation service for the PPIP_ORST_LAST_YEAR ProductPromo condition input value: " + ServiceUtil.getErrorMessage(result), module) + logError("Error calling getOrderedSummaryInformation service for the PPIP_ORST_LAST_YEAR ProductPromo condition input value: " + ServiceUtil.getErrorMessage(result)) return serviceResult } else { Double orderSubTotal = (Double) result.get("totalSubRemainingAmount") - if (Debug.verboseOn()) Debug.logVerbose("Doing order history sub-total compare: orderSubTotal=" + orderSubTotal + ", for last year.", module) + if (Debug.verboseOn()) logVerbose("Doing order history sub-total compare: orderSubTotal=" + orderSubTotal + ", for last year.") compareBase = orderSubTotal.compareTo(Double.valueOf(condValue)) } } catch (GenericServiceException e) { - Debug.logError(e, "Error getting order history sub-total in the getOrderedSummaryInformation service, evaluating condition to false.", module) + logError(e, "Error getting order history sub-total in the getOrderedSummaryInformation service, evaluating condition to false.") return ServiceUtil.returnError("Error getting order history") } } @@ -531,7 +531,7 @@ def productPromoRecurrence() { try { recurrence = new RecurrenceInfo(recurrenceInfo) } catch (RecurrenceInfoException e) { - Debug.logError(e, module) + logError(e, module) } // check the current recurrence @@ -560,7 +560,7 @@ def productShipTotal() { if (condValue) { BigDecimal orderTotalShipping = cart.getTotalShipping() if (Debug.verboseOn()) { - Debug.logVerbose("Doing order total Shipping compare: ordertotalShipping=" + orderTotalShipping, module) + logVerbose("Doing order total Shipping compare: ordertotalShipping=" + orderTotalShipping) } compareBase = orderTotalShipping.compareTo(new BigDecimal(condValue)) } diff --git a/framework/common/groovyScripts/GroovyServiceTest.groovy b/framework/common/groovyScripts/GroovyServiceTest.groovy index 22a9cd0..f35427b 100644 --- a/framework/common/groovyScripts/GroovyServiceTest.groovy +++ b/framework/common/groovyScripts/GroovyServiceTest.groovy @@ -18,52 +18,51 @@ */ import org.apache.ofbiz.service.ServiceUtil -import org.apache.ofbiz.base.util.Debug -Debug.logInfo("-=-=-=- TEST GROOVY SERVICE -=-=-=-", "") +logInfo("-=-=-=- TEST GROOVY SERVICE -=-=-=-") result = ServiceUtil.returnSuccess() if (context.message) { String message = context.message result.successMessage = (String) "Got message [$message] and finished fine" result.result = message - Debug.logInfo("----- Message is: $message -----", "") + logInfo("----- Message is: $message -----") } else { result.successMessage = (String) "Got no message but finished fine anyway" result.result = (String) "[no message received]" - Debug.logInfo("----- No message received -----", "") + logInfo("----- No message received -----") } return result // GroovyEngine will invoke the no-arg method. public Map testMethod() { - Debug.logInfo("----- no-arg testMethod invoked -----", "") + logInfo("----- no-arg testMethod invoked -----") result = ServiceUtil.returnSuccess() if (context.message) { String message = context.message result.successMessage = (String) "Got message [$message] and finished fine" result.result = message - Debug.logInfo("----- Message is: $message -----", "") + logInfo("----- Message is: $message -----") } else { result.successMessage = (String) "Got no message but finished fine anyway" result.result = (String) "[no message received]" - Debug.logInfo("----- No message received -----", "") + logInfo("----- No message received -----") } return result } // ScriptEngine (JSR-223) will invoke the arg method. public Map testMethod(Map context) { - Debug.logInfo("----- arg testMethod invoked -----", "") + logInfo("----- arg testMethod invoked -----") result = ServiceUtil.returnSuccess() if (context.message) { String message = context.message result.successMessage = (String) "Got message [$message] and finished fine" result.result = message - Debug.logInfo("----- Message is: $message -----", "") + logInfo("----- Message is: $message -----") } else { result.successMessage = (String) "Got no message but finished fine anyway" result.result = (String) "[no message received]" - Debug.logInfo("----- No message received -----", "") + logInfo("----- No message received -----") } return result } diff --git a/framework/service/src/main/groovy/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy b/framework/service/src/main/groovy/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy index e508a17..7fe1edb 100644 --- a/framework/service/src/main/groovy/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy +++ b/framework/service/src/main/groovy/org/apache/ofbiz/service/engine/GroovyBaseScript.groovy @@ -30,6 +30,10 @@ import org.apache.ofbiz.entity.GenericValue abstract class GroovyBaseScript extends Script { public static final String module = GroovyBaseScript.class.getName() + String getModule() { + return this.class.getName() + } + Map runService(String serviceName, Map inputMap) throws ExecutionServiceException { LocalDispatcher dispatcher = binding.getVariable('dispatcher') DispatchContext dctx = dispatcher.getDispatchContext() @@ -121,16 +125,18 @@ abstract class GroovyBaseScript extends Script { } } def logInfo(String message) { - Debug.logInfo(message, module) + Debug.logInfo(message, getModule()) } def logWarning(String message) { - Debug.logWarning(message, module) + Debug.logWarning(message, getModule()) } def logError(String message) { - Debug.logError(message, module) + Debug.logError(message, getModule()) + } + def logError(Throwable t, String message) { + Debug.logError(t, message, getModule()) } - def logVerbose(String message) { - Debug.logVerbose(message, module) + Debug.logVerbose(message, getModule()) } } diff --git a/framework/webtools/groovyScripts/artifactinfo/TestSuiteInfo.groovy b/framework/webtools/groovyScripts/artifactinfo/TestSuiteInfo.groovy index 26cafcf..d33ebe1 100644 --- a/framework/webtools/groovyScripts/artifactinfo/TestSuiteInfo.groovy +++ b/framework/webtools/groovyScripts/artifactinfo/TestSuiteInfo.groovy @@ -20,7 +20,6 @@ import org.apache.ofbiz.base.component.ComponentConfig import org.apache.ofbiz.base.config.GenericConfigException import org.apache.ofbiz.base.config.ResourceHandler -import org.apache.ofbiz.base.util.Debug import org.apache.ofbiz.base.util.UtilXml import org.apache.ofbiz.base.util.UtilMisc @@ -50,7 +49,7 @@ for (ComponentConfig.TestSuiteInfo testSuiteInfo: ComponentConfig.getAllTestSuit } } catch (GenericConfigException e) { String errMsg = "Error reading XML document from ResourceHandler for loader [" + testSuiteResource.getLoaderName() + "] and location [" + testSuiteResource.getLocation() + "]" - Debug.logError(e, errMsg, module) + logError(e, errMsg) throw new IllegalArgumentException(errMsg) } diff --git a/framework/webtools/groovyScripts/entity/XmlDsDump.groovy b/framework/webtools/groovyScripts/entity/XmlDsDump.groovy index c0a7fa0..5ec0469 100644 --- a/framework/webtools/groovyScripts/entity/XmlDsDump.groovy +++ b/framework/webtools/groovyScripts/entity/XmlDsDump.groovy @@ -225,7 +225,7 @@ if (passedEntityNames) { TransactionUtil.commit(beganTransaction) } catch (Exception e) { errMsg = "Error reading data for XML export:" - Debug.logError(e, errMsg, "JSP") + logError(e, errMsg) TransactionUtil.rollback(beganTransaction, errMsg, e) } } diff --git a/framework/webtools/groovyScripts/stats/StatBinsHistory.groovy b/framework/webtools/groovyScripts/stats/StatBinsHistory.groovy index d884691..ef21d09 100644 --- a/framework/webtools/groovyScripts/stats/StatBinsHistory.groovy +++ b/framework/webtools/groovyScripts/stats/StatBinsHistory.groovy @@ -27,7 +27,7 @@ type = -1 try { type = Integer.valueOf(typeStr) } catch (NumberFormatException nfe) { - Debug.logError(nfe, "Caught an exception : " + nfe.toString(), "StatBinsHistory.groovy") + logError(nfe, "Caught an exception : " + nfe.toString()) errMsgList.add("Entered value is non-numeric for numeric field: " + field.getName()) } diff --git a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/log/FetchLogs.groovy b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/log/FetchLogs.groovy index 9143405..d96bd23 100644 --- a/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/log/FetchLogs.groovy +++ b/framework/webtools/src/main/groovy/org/apache/ofbiz/webtools/log/FetchLogs.groovy @@ -67,7 +67,7 @@ if (parameters.logFileName && listLogFileNames.contains(parameters.logFileName)) logLines.add([type: type, line:line]) } } catch (Exception e) { - Debug.logError(e, "FetchLogs.groovy"); + logError(e, module) } context.logLines = logLines } |
Free forum by Nabble | Edit this page |