<apidoc:module name="TraceBuiltins" category="Error and Trace" lib="fn" xmlns:apidoc="http://marklogic.com/xdmp/apidoc"><apidoc:summary access="public">
<p xmlns="http://www.w3.org/1999/xhtml">The error and trace built-in functions are XQuery functions defined for 
throwing errors from XQuery programs and debug tracing.
They are defined in
<a href="http://www.w3.org/TR/xpath-functions/">XQuery 1.0 
and XPath 2.0 Functions and Operators</a>. 
</p>
<p xmlns="http://www.w3.org/1999/xhtml">The error and trace built-in functions use the <code>fn</code> namespace
prefix, which is predefined in the server.  Also, the <code>fn</code>
prefix is the default prefix for function calls if none is specified.</p>
</apidoc:summary><apidoc:function name="trace" type="builtin" lib="fn" category="Error and Trace" bucket="W3C-Standard Functions" hidden="false">
    <apidoc:summary>
  Return the input $value unchanged and, if $label is the name of
  an enabled server event, emit that server event to the server log
  file (<code xmlns="http://www.w3.org/1999/xhtml">ErrorLog.txt</code>) with $value as its data.
</apidoc:summary>
    <apidoc:params>
      <apidoc:param name="value" type="item()*" optional="false">
   The values to trace.
  </apidoc:param>
      <apidoc:param name="label" type="xs:string" optional="false">
   A string label for the trace output.
  </apidoc:param>
    </apidoc:params>
    <apidoc:return>item()*</apidoc:return>
    <apidoc:usage>
  In order for the trace event to print out in the log file, you must enable 
  the trace event in the Diagnostics page (Groups &gt; <em xmlns="http://www.w3.org/1999/xhtml">group_name</em> &gt; 
  Diagnostics ) of the Admin interface for the specified label.
</apidoc:usage>
    <apidoc:example><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
fn:trace("This is a trace event.", "MY TRACE EVENT")

=&gt; If MY TRACE EVENT is defined as an enabled trace event
   in the Diagnostics page of the Admin interface, then a
   message similar to the following is added to the 
   ErrorLog.txt file:

   2006-03-20 17:56:09.346 Info: [Event:id=MY TRACE EVENT] 
                                 This is a trace event.
</pre>
</apidoc:example>
  </apidoc:function></apidoc:module>