zlog
FORMULA

The zlog statement outputs a message to the instrumentation log (if instrumentation is enabled).


Parameters

This statement has one parameter:

formula – message to output to log.


Description

This statement outputs a message to the instrumentation log, but only if instrumentation is enabled. If instrumentation is not currently enabled for this procedure, the zlog statement does nothing. See Debug Instrumentation to learn how to configure instruments.

The zlog statement has one parameter, a formula that is used to calculate the message to be sent to the log. In its simplest form, this could simply be a a text constant.

zlog "Put this into the instrument log."

The message can be any formula that produces a text result. This statement will put the current database name into the log.

zlog "Current database: "+info("databasename")

It’s very common to display a field or variable value, like this.

zlog "Customer: "+Customer

To eliminate the need to type in the field or variable name twice, use the labelize( function, like this:

zlog labelize(Customer)

You can use the labelize( function in a larger formula, even use more than one labelize( function in a single zlog statement.

zlog labelize(Customer)+", "+labelize(OrderNumber)

Other similar functions you may find useful include labelizeformula( and labelizeinfo(. If you need to send the contents of a dictionary to log, use the zlogdictionary statement instead of zlog.

The zlog statement normally adds a prefix to each line in the log, showing the name of the procedure that contains the zlog statement. For example, if a procedure named New Order contained this code:

zlog labelize(Customer)+", "+labelize(OrderNumber)

the log output would look something like this:

[New Order] Customer: Leanne Mathers, OrderNumber: 429

If you don’t want this prefix, start the message with /-/, like this:

zlog "/-/"+labelize(Customer)+", "+labelize(OrderNumber)

With this code, the log output will look like this:

Customer: Leanne Mathers, OrderNumber: 429

You might find it useful to suppress the prefix if you are creating your own header, for example:

zlog "/-/=== START OF NEW ORDER PROCEDURE ==="

Remember, you can keep zlog statements in your code permanently. They only output to the log if instrumentation is enabled, which can be done on a procedure-by-procedure basis. So when you aren’t interested in the log output, you can simply turn off instrumentation (see Debug Instrumentation) instead of manually removing all the zlog statements. If you need them again later, they can be enabled in an instant.


See Also


History

VersionStatusNotes
10.2NewNew in this version.