logmessage ( warningtype, format, parm1, parm2 );
If logging is turned on in the Map Designer, this built-in function causes a message to be logged to the Map Designer log file. To turn logging on in the Map Designer, choose Preferences from the View Menu and on the Logging Defaults tab, check Error and Event Logging ON/OFF. Or for these same settings on an individual conversion level, choose Error Logging on the Conversion Properties window. The log file may be set, along with the message types to be logged. Since logmessage logs warning and error messages, these message types should be selected on the Error Logging node in Conversion Properties, or the Default Logging tab in Preferences to ensure that they are logged. When the Map Designer returns an error, the last logged message will be returned with the error.
The warningtype parameter is the message type and is always required. The two allowable values for the message type are "warn" and "error". If the value "warn" is passed as the warningtype, the Map Designer treats it as a warning message. Otherwise, "" (empty string) or "error" are treated as error messages. The warningtype is not case sensitive.
The format parameter is always required and specifies the printf-style message format. It is an expression whose string value contains both literal text to be printed and specifications of how the variable parameters are to be formatted. There can be 0, 1 or 2 % specifications included in the message format parameter. The % specification currently supported is %s for string variables. The parm1 and parm2 parameters are optional. They are value parameters for % specifications included in the format parameter.
Example
if(length($0) == 0)
logmessage("WARN", "Input file line %s is empty!", NR);
In this example, the parm2 parameter was not used since there was only one % specification in the format parameter. If NR is equal to 5, a warning message "Input file line 5 is empty" will be logged to the log file.
Last modified date: 12/03/2024