Generates a trace message.
Syntax
void trace(String traceMsg)
void trace(int traceLevel, String traceMsg)
void trace(int traceLevel, int messageNum)
void trace(int traceLevel, int messageNum, String param [,...])
void trace(int traceLevel, int messageNum, Object[] paramArray)
Parameters
- traceLevel
- The tracing level that causes the message to be generated.
- traceMsg
- A string that prints to the trace file.
- messageNum
- A number that represents a message in the map message
file.
- param
- A single parameter. You can add additional single parameters,
separated by commas, up to a total of five.
- paramArray
- An array of parameters.
Notes
The trace() method generates a message that the map
prints if tracing is turned on. This method has five forms:
- The first form takes just a string message that appears when
tracing is set to any level.
- The second form takes a trace level and a string message that
appears when tracing is set to the specified level or a higher
level.
- The third form takes a trace level and a number that represents
a message in the map message file. The entire message text appears
in the message file and is printed as it is, without parameters,
when tracing is set to the specified level or a higher level.
- The fourth form takes a trace level, a number that represents a
message in the map message file, and one or more parameters to be
used in the message. You can send up to five parameter values to be
used with the message by separating the values with commas.
- The fifth form takes a trace level, a number that represents a
message in the map message file, and an array of parameter
values.
- Note:
- All forms of the method that take a messageNum
parameter require the use of a message file that is indexed by
message number. For information on how to set up a message text
file, refer to Appendix A, "Message
files".
You can set the trace level for a map as part of the Map Properties.
Examples
The following example generates a Level 2 trace message and
supplies the text of the message:
trace (2, "Starting to trace at Level 2");
The following example prints message 201 in the map message file
if the trace level is 2 or higher. The message has two parameters,
a name and a year, for which this method call passes values.
trace(2, 201, "DAVID", "1961");
See also
logError(), logInfo(),
logWarning()
