Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
Automation Scripting User Guide
Table of Contents Expand all
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

trace

date_range 13-Jan-21

Syntax

content_copy zoom_out_map
trace expression;

trace {
   /* body */
}

Description

Write a message to the trace file, if tracing is enabled. If tracing is not enabled, trace output is not generated. The trace message can be an XPath expression or string, or it can be generated by the contents of a trace statement block.

Enabling of tracing is typically a feature of the environment in which a SLAX script is called. When executing a script using the slaxproc command, include the --trace or -t option to enable tracing. For more information about slaxproc, see Understanding the SLAX Processor (slaxproc).

Attributes

trace expression

XPath expression or string written to the trace file.

SLAX Example

The following examples demonstrate the trace statement syntax. The first example writes a concatenated string to the trace file. The second example uses a code block to output a <max> element and a <min> element and the values of the max and min variables. The third example uses a conditional statement to specify when to output trace data. If the expression evaluates to true, the code block writes the string and the <options> element hierarchy to the trace file.

content_copy zoom_out_map
trace "max " _ $max _ "; min " _ $min;

trace {
    <max> $max;
    <min> $min;
}

trace {
    if ($my-trace-flag) {
        expr "max " _ $max _ "; min " _ $min;
        copy-of options;
    }
}

Release Information

Statement introduced in version 1.1 of the SLAX language, which is supported in Junos OS Release 12.2 and later releases.

footer-navigation