Message parameters

It is not necessary to write separate messages for each possible situation. Instead, use parameters to represent values that change at runtime. The use of parameters allows each message to serve multiple situations and helps to keep the message file small.

A parameter always appears as a number surrounded by curly braces: {number}. For each parameter you want to add to the message, insert the number within curly braces into the text of the message, as follows:

message text {number} more message text.
 

The API method that is called to log the message must supply a value for each parameter. For example, consider the following message:

6
 Update failed. Destination application missing entry for {1} {2} 
 

In the code fragment that sends this message, the following code appears:

logWarning(6, " CustomerID" , fromCust.getString("CustomerID")); 
 

InterChange Server combines the parameter values in the logWarning() method call with the message in the log file and forms the message. Before writing the message to the log file, the server replaces the message parameters with the following values:

The message then appears in the log file as follows:

Update failed. Destination application missing entry for CustomerID 101961
 

Because the message text takes the description of the missing entry and its ID as parameters, rather than including them as hardcoded strings, you can use the same message for any pair of missing attributes.

Copyright IBM Corp. 2003, 2004