<log>
Generates CallLogging (Nuance standard call record) logging events within VoiceXML. These messages can be used to debug applications, generate billing records, provide application statistics, and more.
A <log> directly cannot appear directly within a <field> element, although it may be contained in a field’s event handlers. If field entry or exit must be logged, a <log> may be placed within a matching <block> immediately before or after the <field> element:
<vxml>
<form>
...
<block cond="myselection == 1">
<log expr="'Entered the confirmation field.'"/>
</block>
<field name="confirm1" type="boolean" cond="myselection == 1" >
<prompt>You selected option one, is that correct?</prompt>
</field>
...
</form>
</vxml>
The <log> element can also be used to create custom alarms.
Attributes
This section describes the attributes you can set for this element.
|
Name |
Data type |
Default |
|---|---|---|
|
CDATA |
optional |
|
|
CDATA |
optional |
expr
Nuance recommends that the expr attribute contain a JavaScript expression that evaluates to the message logged under a given label, for example:
<log label="trace:?level=INFO" expr="'The value of x is ' + x"/>
The expression must conform to ECMAScript syntax. In particular, any constant part of the expression (such as ‘The value of x is ’ in this example) must be enclosed in single quotes within the external double quotes to ensure it does not cause an error.
Alternately, the <log> element can contain content that describes the message to be evaluated. This content can include the <value> element in order to reference variables within the message and evaluate them at logging time. For example:
<log label="trace:?level=INFO">The value of x is <value expr="x"/></log>
label
When the <log> element is executed, the specified debugging information is routed to the destination specified by the label attribute. Currently, three types of destinations are supported:
- Trace messages are sent to Voice Browser service diagnostic log files for browser logging.
- Call log events are sent to Voice Platform call log files.
- Catalogued messages are sent to diagnostic log files using the Voice Platform message catalog URL.
The label attribute is a URI which specifies the type of destination to use, for example:
<log label="trace:?level=INFO"> The value of x is <value expr="x"/></log>
or
<log label="calllog:?key=My_X_VAR" expr="x"/>
or
<log label="message-url"> message_text <value expr="insertion"/></log>
If no label is specified, by default the message will be logged to the Voice Browser service diagnostic log as an INFO level message.
For trace messages, the URI is specified as follows:
"trace:?level=LEVEL"
Where
LEVEL allows you to specify the debug level at which the result is reported to the system. The INFO level is intended for use by VoiceXML applications, but you can choose any valid value for the level attribute. If the level attribute is not specified, the result is reported at the INFO level.
This table lists the debug levels that the Voice Browser service logging infrastructure supports.
|
Debug level |
Description |
|---|---|
|
FATAL |
fatal errors |
|
ERROR |
fatal errors, nonfatal errors |
|
WARN |
fatal errors, nonfatal errors, warnings |
|
USER_ERROR |
The system encountered a serious error while processing user-supplied data. For example, a grammar file contains errors and fails to compile. |
|
USER_WARN |
The system encountered an unexpected problem while processing user-supplied data. For example, a grammar file contains errors but it still compiles. Investigate the errors. |
|
STATUS |
fatal errors, nonfatal errors, warnings, status information |
|
INFO |
fatal errors, nonfatal errors, warnings, status information, application (VoiceXML) errors |
|
D_INFO (detailed info) |
fatal errors, nonfatal errors, warnings, status information, application (VoiceXML) errors, timestamp, datestamp, Voice Browser service status messages |
|
VD_INFO (very detailed info) |
fatal errors, nonfatal errors, warnings, status information, application (VoiceXML) errors, timestamp, datestamp, Voice Browser service status messages, Voice Platform messages |
For call log events, the URI is specified as follows:
"calllog:?key=KEY"
Where:
KEY is the key to use in the call log for this particular event.
Children
- Parsed character data
- <value>
Parents
Sample code
<log label="calllog:?key=MY_X_VAR" expr="'Current value of x: ' + x"/>