Documentation Gestion of the error message
In order to permit all the module to access the ApplicationLog generated by your application , a screen have been developed this screen is situated in : framework/common/widget/ApplicationLogScreens.xml ViewApplicationLog So you will need to include this screen. Here is an exemple of a screen including the screen ViewApplicationLog
<screen name="ViewApplicationLogPendingScreen">
<section>
<actions>
<set field="descriptionMain" value="Party"/>
<set field="headerItem" value="Party"/>
<set field="subComponent" value="party"/>
<set field="tabButtonItem" value="MessageLogView"/>
<set field="partyId" from-field="parameters.partyId"/>
<set field="fromPage" value="ViewApplicationLogPending"/>
</actions>
<widgets>
<section>
<widgets>
<decorator-screen name="CommonPartyDecorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<include-screen name="ViewApplicationLog" location="component://common/widget/ApplicationLogScreens.xml"/>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</widgets>
</section>
</screen>
The screen ViewApplicationLog has two optional parameters :
- applicationLogPartyId - runId
The first parameter is initialized with the partyId of the user connected , it permit to only see the ApplicationLog which the user has permission of sight and still is the status "Pending". The second parameter is use to restrict the ApplicationLog shown, this mean that only the ApplicationLog with the runId specified will be visible The runId is the identifiant of all the process launched by a service. For exemple if we launch the service "calculateMultiProductCost" a runId is generated by the command :
"runId = delegator.getNextSeqId("ApplicationLog.runId");"
then this parameter is put in the context and all the application launch by this service has the runId in parameter :
calculateCostPrice(DispatchContext ctx, String productId, List budgetCodeList, Timestamp dateRef, String currencyUomId, String facilityIdName, String productPricePurposeId, String productStoreGroupId, boolean multiLevelMode, boolean overrideExistingCostPrice, GenericValue userLogin, Locale locale,String runId)
If none of the parameters has been fullfilled the form belonging to the screen will show all the ApplicationLog in the database
When the parameter applicationLogPartyId is fullfilled and the user has the permission of modification a checkbox is visible at the end of the line. Thanks to the button at the end of the form , it is possible to change the status of the ApplicationLog to "Read" ( Those ApplicationLog with this status will not be shown any more )
you can see one parameter more in the screen ViewApplicationLogPendingScreen : "fromPage" this parameter is needed by the form in the field "paginate-target" belonging to the screen ViewApplicationLog. It is needed in order to use the arrow key ( next, previous) when there is a lot of ApplicationLog in base.
The ApplicationLog contain all this field :
discriminator(String,VARCHAR(20)) : idName(String,VARCHAR(20)) *: logMessage(String,VARCHAR(255)) : logModule(String,VARCHAR(255)) : logTime(java.sql.Timestamp,TIMESTAMP) : runId(String,VARCHAR(20)) : logLevelEnumId(String,VARCHAR(20)) : logCodeIdName(String,VARCHAR(20)) : statusStatusId(String,VARCHAR(20)) : prdtProductId(String,VARCHAR(20)) : partyId(String,VARCHAR(20)) : nFacilityIdName(String,VARCHAR(20))
When an Application is needed to be created you can use those command :
ApplicationLog app=ApplicationLogServices.createLog(delegator,"APPLL_ERROR","Manufacturing_PPNE","ManufacturingProductPriceNotExist",module,runId);
app.setProduct(productId);
ApplicationLogServices.log(app,false);
"APPLL_ERROR" is the level of the applicationLog ( there is several level : "APPLL_FATAL" ,"APPLL_INFO" , "APPLL_WARNING" , "APPLL_ERROR" ,"APPLL_ALERT" ) those level belong to the ApplicationLogLevel you can not use something else
"ManufacturingProductPriceNotExist" is the logMessage
"Manufacturing_PPNE" is the logCodeIdName of the error , it is link to the identifiant of an ApplicationLogCode. In order to use this you will need to create it manually thanks to the webtools.
The ApplicationLogCode contain all this field :
idName(String,VARCHAR(20)) *: -> the name of the identifiant you will need to use to create an ApplicationLog
description(String,VARCHAR(100)) : -> description of the error ( use only if the uiLabel does not exist )
hasTable(String,CHAR(1)) : -> boolean, put Y if it is link to a specific log ( like MrpRunLog )
entity(String,VARCHAR(100)) : -> name of the specific entity log ( MrpRunLog for exemple )
uiLabel(String,VARCHAR(100)) : -> name of the label corresponding in your UiLabel.properties file , permit to have an international description
url(String,VARCHAR(255)) : -> url which has generated the ApplicationLog, permit to go to the error thanks to an hyperlink constructed
thanks to this url and the parameter if there is some
there is also 3 setter which may be usefull when your label or your url contain some parameter:
-setProduct -> this will set the field prdtProductId of the ApplicationLog -setParty -> this will set the field partyId of the ApplicationLog -setNFacility -> this will set the field nFacilityIdName of the ApplicationLog
For exemple if your label name is : "error1" and the value of the label is : " the error has been raised due to ${prdtProductId} " and you have execute the setter app.setProduct("MRP_TABLE") the label shown in the form will be : the error has been raised due to MRP_TABLE
!! BEWARE you will need to execute "ApplicationLogServices.log(app,false)" to store the ApplicationLog otherwise it will not be present in the base !!
If you do NOT need parameters ( only in this case ! ) in uiLabel or url you can also use :
ApplicationLog app=ApplicationLogServices.log(delegator, logLevel, logCodeId, message, logModule, boolean rollbackable, runId)
this command will automatically create an ApplicationLog and store it in the database


