共用方式為


2.2.4.2.2.4 Trace

The Trace complex type represents a trace object. A trace consists of a set of server events that a client can subscribe to by using the Subscribe command.

   <xsd:complexType name="Trace">
     <xsd:all>
       <!--These elements are common to each MajorObject-->
       <xsd:element name="Name"  type="xsd:string" />
       <xsd:element name="ID"  type="xsd:string" minOccurs="0" />
       <xsd:element name="CreatedTimestamp" type="xsd:dateTime" minOccurs="0" />
       <xsd:element name="LastSchemaUpdate" type="xsd:dateTime" minOccurs="0" />
       <xsd:element name="Description" type="xsd:string" minOccurs="0" />
       <xsd:element name="Annotations"  minOccurs="0" >
         <xsd:complexType>
           <xsd:sequence>
             <xsd:element name="Annotation" type="Annotation" minOccurs="0"
                          maxOccurs="unbounded" />
           </xsd:sequence>
         </xsd:complexType>
       </xsd:element>
       <!--Extended elements for Trace object-->
       <xsd:element name="LogFileName" type="xsd:string" minOccurs="0"/>
       <xsd:element name="LogFileAppend" type="xsd:boolean" minOccurs="0"/>
       <xsd:element name="LogFileSize" type="xsd:long"  minOccurs="0" />
       <xsd:element name="Audit" type="xsd:boolean" minOccurs="0"/>
       <xsd:element name="LogFileRollover" type="xsd:boolean" minOccurs="0"/>
       <xsd:element name="AutoRestart" type="xsd:boolean" minOccurs="0"/>
       <xsd:element name="StopTime" type="xsd:dateTime" minOccurs="0"/>
       <xsd:element name="Filter" type="TraceFilter"  minOccurs="0" />
       <xsd:choice maxOccurs="1" minOccurs="1">
         <xsd:element name="Events" >
           <xsd:complexType>
             <xsd:sequence>
               <xsd:element name="Event"  type="Event" minOccurs="0"
                            maxOccurs="unbounded"/>
             </xsd:sequence>
           </xsd:complexType>
         </xsd:element>
         <xsd:element ref="eng300_300:XEvent" minOccurs="0" />
       </xsd:choice>
     </xsd:all>
   </xsd:complexType>

The Trace XSD depends upon the following definition in namespaces other than the default namespace.

In the namespace eng300_300:

 <xsd:element name="XEvent">
    <xsd:complexType>
     <xsd:element name="event_session"/>
   </xsd:complexType>
 </xsd:element>

The following table describes the elements that are included in the XSD schema for Trace.

Element

Read-Only

Default value

Description

LogFileName

Empty

The file name for the log file. LogFileName MUST contain the .trc file name extension.

LogFileAppend

False

When true, indicates to append to the existing log file; otherwise, false.

LogFileSize

0

An integer that sets maximum file size in MB. If zero or negative, it means no maximum size.<53>

Audit

False

When true, indicates that a Trace element is not allowed to drop events, even if this results in degraded performance on the server; otherwise, false.

LogFileRollover

False

A Boolean that indicates what to do if LogFileSize is exceeded. If true, a new file is started; if false, logging stops.

AutoRestart

False

When true, performs a Trace auto restart with service stop/start; otherwise, false.

StopTime

No stop time

The time that the server will stop logging to the Trace log file.

Filter

Empty

A complex XML type that specifies a logical condition that will determine whether the event is included in Trace output.<54>

Events

A collection of Event objects. This element is required if XEvent is not specified.

XEvent

An optional element that can be specified if the client code wants to subscribe to get information in XEvent format.