EventSchemaTraceListener 类

定义

将端对端事件的跟踪或调试输出定向到 XML 编码的符合架构的日志文件。Directs tracing or debugging output of end-to-end events to an XML-encoded, schema-compliant log file.

public ref class EventSchemaTraceListener : System::Diagnostics::TextWriterTraceListener
public class EventSchemaTraceListener : System.Diagnostics.TextWriterTraceListener
type EventSchemaTraceListener = class
    inherit TextWriterTraceListener
Public Class EventSchemaTraceListener
Inherits TextWriterTraceListener
继承

示例

下面的代码示例演示如何使用EventSchemaTraceListener类。The following code example demonstrates how to use the EventSchemaTraceListener class.


///////////////////////////////////////////////////////////////////////
//
// EventSchemaTraceListener.cpp : main project file.
// Expected Output:
// 1)
//      EventSchemaTraceListener CPP Sample
//
//      IsThreadSafe? True
//      BufferSize =  65536
//      MaximumFileSize =  20480000
//      MaximumNumberOfFiles =  2
//      Name =  eventListener
//      TraceLogRetentionOption = LimitedCircularFiles
//      TraceOutputOptions = DateTime, Timestamp, ProcessId
//
//      Press the enter key to exit
//
// 2) An output file is created named TraceOutput.xml.  It will be
//    opened and displayed in Microsoft Notepad.
//
// NOTE 1:
//  Under certain circumstances, the VS C++ compiler will treat
//          Console::WriteLine("MyText = " + MyVar);
//        differently then the VS CSharp compiler.
//        The C++ compiler will produce error C3063, whereas the 
//        CSharp compiler accepts the statement.
//        This occurs when the VS C++ compiler cannot determine the
//        datatype of "MyVar" because it is an enumeration type.
//        The solution is:
//        Use either of the following two methods:
//          Console::WriteLine("MyText = {0} " , MyVar);
//          Console::WriteLine("MyText =  " + MyVar.ToString());
//
//        Although not specific to this particular pieces of code,
//        this is demonstrated below in the Display function:  The
//        last two members, TraceLogRetentionOption, and
//        TraceOutputOptions, are enumerations, and cannot simply be
//        concatenated into Console::WriteLine.
//
///////////////////////////////////////////////////////////////////////
#using <System.dll>
#using <System.Core.dll>

#define NOCONFIGFILE 1
using namespace System;
using namespace System::IO;
using namespace System::Diagnostics;


[STAThreadAttribute]
void main()
{
    Console::WriteLine("EventSchemaTraceListener CPP Sample\n");

    File::Delete("TraceOutput.xml");
    TraceSource ^ ts = gcnew TraceSource("TestSource");


#if NOCONFIGFILE
    ts->Listeners->Add(gcnew EventSchemaTraceListener("TraceOutput.xml",
                            "eventListener", 65536,
                            TraceLogRetentionOption::LimitedCircularFiles,
                            20480000, 2));
    ts->Listeners["eventListener"]->TraceOutputOptions =
                                    TraceOptions::DateTime |
                                    TraceOptions::ProcessId |
                                    TraceOptions::Timestamp;
#endif

    EventSchemaTraceListener ^ ESTL =
               (EventSchemaTraceListener^)(ts->Listeners["eventListener"]);


    Console::WriteLine("IsThreadSafe?            = " + ESTL->IsThreadSafe);
    Console::WriteLine("BufferSize               = " + ESTL->BufferSize);
    Console::WriteLine("MaximumFileSize          = " + ESTL->MaximumFileSize);
    Console::WriteLine("MaximumNumberOfFiles     = " + ESTL->MaximumNumberOfFiles);
    Console::WriteLine("Name                     = " + ESTL->Name);
    Console::WriteLine("TraceLogRetentionOption  = " + ESTL->TraceLogRetentionOption.ToString());
    Console::WriteLine("TraceOutputOptions       = {0}\n", ESTL->TraceOutputOptions);

    ts->Switch->Level = SourceLevels::All;
    String ^ testString = "<Test><InnerElement Val=\"1\" />"
                        + "<InnerElement Val=\"Data\"/>"
                        + "<AnotherElement>11</AnotherElement></Test>";

    UnescapedXmlDiagnosticData ^ unXData = gcnew UnescapedXmlDiagnosticData(testString);
    ts->TraceData(TraceEventType::Error, 38, unXData);
    ts->TraceEvent(TraceEventType::Error, 38, testString);
    ts->Flush();
    ts->Close();

    Process::Start("notepad.exe", "TraceOutput.xml");
    Console::WriteLine("\nPress the enter key to exit");
    Console::ReadLine();
}
#define NOCONFIGFILE
using System;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Diagnostics;

class testClass
{
    [STAThreadAttribute]
    static void Main()
    {
        File.Delete("TraceOutput.xml");
        TraceSource ts = new TraceSource("TestSource");
#if NOCONFIGFILE
        //ts.Listeners.Add(new EventSchemaTraceListener("TraceOutput.xml", "eventListener", 65536, TraceLogRetentionOption.LimitedCircularFiles, 20480000, 2));
        ts.Listeners.Add(new EventSchemaTraceListener("TraceOutput.xml", "eventListener"));
        ts.Listeners["eventListener"].TraceOutputOptions = TraceOptions.DateTime | TraceOptions.ProcessId | TraceOptions.Timestamp;
#endif
        ts.Switch.Level = SourceLevels.All;
        string testString = "<Test><InnerElement Val=\"1\" /><InnerElement Val=\"Data\"/><AnotherElement>11</AnotherElement></Test>";
        UnescapedXmlDiagnosticData unXData = new UnescapedXmlDiagnosticData(testString);
        ts.TraceData(TraceEventType.Error, 38, unXData);
        ts.TraceEvent(TraceEventType.Error, 38, testString);
        Trace.Listeners.Add(new EventSchemaTraceListener("TraceOutput.xml"));
        Trace.Write("test", "test");
        Trace.Flush();
        ts.Flush();
        ts.Close();
        DisplayProperties(ts);
        Process.Start("notepad.exe", "TraceOutput.xml");
        Console.WriteLine("Press the enter key to exit");
        Console.ReadLine();
    }
    private static void DisplayProperties(TraceSource ts)
    {
        Console.WriteLine("IsThreadSafe? " + ((EventSchemaTraceListener)ts.Listeners["eventListener"]).IsThreadSafe);
        Console.WriteLine("BufferSize =  " + ((EventSchemaTraceListener)ts.Listeners["eventListener"]).BufferSize);
        Console.WriteLine("MaximumFileSize =  " + ((EventSchemaTraceListener)ts.Listeners["eventListener"]).MaximumFileSize);
        Console.WriteLine("MaximumNumberOfFiles =  " + ((EventSchemaTraceListener)ts.Listeners["eventListener"]).MaximumNumberOfFiles);
        Console.WriteLine("Name =  " + ((EventSchemaTraceListener)ts.Listeners["eventListener"]).Name);
        Console.WriteLine("TraceLogRetentionOption =  " + ((EventSchemaTraceListener)ts.Listeners["eventListener"]).TraceLogRetentionOption);
        Console.WriteLine("TraceOutputOptions =  " + ((EventSchemaTraceListener)ts.Listeners["eventListener"]).TraceOutputOptions);
    }
}
#Const NOCONFIGFILE = True
Imports System.IO
Imports System.Xml
Imports System.Xml.XPath
Imports System.Diagnostics

Class testClass

    <STAThreadAttribute()> _
    Shared Sub Main()
        File.Delete("TraceOutput.xml")
        Dim ts As New TraceSource("TestSource")
#If NOCONFIGFILE Then
        ts.Listeners.Add(New EventSchemaTraceListener("TraceOutput.xml", "eventListener", 65536, TraceLogRetentionOption.LimitedCircularFiles, 20480000, 2))
        ts.Listeners("eventListener").TraceOutputOptions = TraceOptions.DateTime Or TraceOptions.ProcessId Or TraceOptions.Timestamp
#End If
        ts.Switch.Level = SourceLevels.All
        Dim testString As String = "<Test><InnerElement Val=""1"" /><InnerElement Val=""Data""/><AnotherElement>11</AnotherElement></Test>"
        Dim unXData As New UnescapedXmlDiagnosticData(testString)
        ts.TraceData(TraceEventType.Error, 38, unXData)
        ts.TraceEvent(TraceEventType.Error, 38, testString)
        ts.Flush()
        ts.Close()
        DisplayProperties(ts)
        Process.Start("notepad.exe", "TraceOutput.xml")
        Console.WriteLine("Press the enter key to exit")
        Console.ReadLine()

    End Sub

    Private Shared Sub DisplayProperties(ByVal ts As TraceSource)
        Console.WriteLine("IsThreadSafe? " + CType(ts.Listeners("eventListener"), EventSchemaTraceListener).IsThreadSafe.ToString())
        Console.WriteLine("BufferSize =  " + CType(ts.Listeners("eventListener"), EventSchemaTraceListener).BufferSize.ToString())
        Console.WriteLine("MaximumFileSize =  " + CType(ts.Listeners("eventListener"), EventSchemaTraceListener).MaximumFileSize.ToString())
        Console.WriteLine("MaximumNumberOfFiles =  " + CType(ts.Listeners("eventListener"), EventSchemaTraceListener).MaximumNumberOfFiles.ToString())
        Console.WriteLine("Name =  " + CType(ts.Listeners("eventListener"), EventSchemaTraceListener).Name)
        Console.WriteLine("TraceLogRetentionOption =  " + CType(ts.Listeners("eventListener"), EventSchemaTraceListener).TraceLogRetentionOption.ToString())
        Console.WriteLine("TraceOutputOptions =  " + CType(ts.Listeners("eventListener"), EventSchemaTraceListener).TraceOutputOptions.ToString())
    End Sub
End Class

注解

EventSchemaTraceListener类提供对端到端架构兼容事件的跟踪。The EventSchemaTraceListener class provides tracing of end-to-end schema-compliant events. 对于具有跨线程、 AppDomain、进程和计算机边界的异类组件的系统, 可以使用端对端跟踪。You can use end-to-end tracing for a system that has heterogeneous components that cross thread, AppDomain, process, and computer boundaries. 标准事件架构 (请参阅事件使用者的事件表示形式) 已定义为在这些边界之间启用跟踪。A standardized event schema (see Event Representation for Event Consumers) has been defined to enable tracing across these boundaries. 此外,该架构允许添加符合架构的自定义元素。The schema enables the addition of custom, schema-compliant elements. 您可以使用服务跟踪查看器工具 (svctraceviewer.exe)来显示事件数据。You can use the Service Trace Viewer Tool (SvcTraceViewer.exe) to display the event data.

EventSchemaTraceListener针对无锁定跟踪的隐式支持优化了日志记录性能。EventSchemaTraceListener is tuned for logging performance with implicit support for lock-free tracing.

EventSchemaTraceListener类将跟踪和调试信息转换为 XML 编码的文本流。The EventSchemaTraceListener class converts tracing and debugging information into an XML-encoded text stream. 本部分后面的表中显示了对 XML 输出的说明。The description of the XML output is shown in the tables later in this section.

您可以通过应用程序配置EventSchemaTraceListener文件启用或禁用对象, 然后在您的应用程序EventSchemaTraceListener中使用配置的对象。You can enable or disable an EventSchemaTraceListener object through the application configuration file, and then use the configured EventSchemaTraceListener object in your application. 或者, 您可以在代码EventSchemaTraceListener中创建对象。Alternately, you can create an EventSchemaTraceListener object in your code. 建议通过应用程序配置文件启用跟踪侦听器。We recommend that you enable trace listeners through the application configuration file. 有关使用配置文件进行跟踪和调试的信息, 请参阅跟踪和调试设置架构For information about the use of configuration files for tracing and debugging, see Trace and Debug Settings Schema.

若要配置EventSchemaTraceListener对象, 请修改对应于应用程序名称的配置文件。To configure an EventSchemaTraceListener object, modify the configuration file that corresponds to the name of your application. 在此文件中, 您可以添加、删除或设置侦听器的属性。In this file, you can add, remove, or set the properties for a listener. 配置文件的格式应如下所示:The configuration file should be formatted as follows:

<configuration>  
    <system.diagnostics>  
        <sources>  
            <source name="TestSource" >  
                <listeners>  
                    <!--Remove the default trace listener for better performance.-->  
                    <remove name="Default"/>  
                    <!--Note: Removing the default trace listener prevents the dialog box   
                    from being displayed for Debug.Fail or Debug.Assert commands that are   
                    executed in user mode.-->  
                    <add name="eventListener"   
                      type="System.Diagnostics.EventSchemaTraceListener,  system.core"  
                      initializeData="TraceOutput.xml"   
                      traceOutputOptions="ProcessId, DateTime, Timestamp"   
                      bufferSize="65536"  
                      maximumFileSize="20480000"  
                      logRetentionOption="LimitedCircularFiles"  
                      maximumNumberOfFiles="2"/>  
                </listeners>  
            </source>  
        </sources>  
    </system.diagnostics>  

类从基类Filter 继承TraceListener属性。 EventSchemaTraceListenerThe EventSchemaTraceListener class inherits the Filter property from the base class TraceListener. Filter属性允许在侦听器上进行额外级别的跟踪输出筛选。The Filter property allows for an additional level of trace output filtering at the listener. 如果存在筛选器, 则跟踪Trace侦听器的方法将调用筛选器ShouldTrace的方法, 以确定是否发出跟踪。If a filter is present, the Trace methods of the trace listener call the ShouldTrace method of the filter to determine whether to emit the trace.

如果尝试写入正在使用或不可用的文件, 则会自动将 GUID 后缀添加到文件名。If an attempt is made to write to a file that is being used or is unavailable, a GUID suffix is automatically added to the file name.

备注

侦听器方法旨在由DebugTraceTraceSource类的方法调用。Listener methods are intended to be called by methods of the Debug, Trace, and TraceSource classes. 不要直接从应用程序代码调用侦听器方法。Do not call the listener methods directly from application code. 侦听器主要供TraceSource类使用。 EventSchemaTraceListenerThe EventSchemaTraceListener listener is primarily intended for use by the TraceSource class.

下表介绍了 XML 输出的元素和属性。The following table describes the elements and attributes of the XML output.

元素Element 特性Attributes OutputOutput 说明Notes
CallStack NoneNone 取决于TraceOutputOptions属性中是否存在Callstack该标志。Depends on the presence of the Callstack flag in the TraceOutputOptions property. 特殊字符 (如 > 或 <) 将替换为转义序列。Special characters such as > or < are replaced with escape sequences. 请参阅下表中的转义字符转换表。See the escaped character translation table in the next table.
Computer NoneNone 始终存在。Always present. 此元素表示MachineName属性的值。This element represents the value of the MachineName property.
Correlation ActivityID 始终存在。Always present. 如果ActivityID未指定, 则默认值为空 GUID。If ActivityID is not specified, the default is an empty GUID.
RelatedActivityID 取决于Trace方法调用中是否relatedActivityId存在参数。Depends on the presence of the relatedActivityId parameter in the Trace method call. 特性对应于方法的relatedActivityId TraceTransfer参数。 RelatedActivityIDThe RelatedActivityID attribute corresponds to the relatedActivityId parameter of the TraceTransfer method.
Data NoneNone 始终存在。Always present. 此元素表示参数输入 (data)。This element represents parameter input (data). 为每个数据对象提供一个元素。One element is provided for each data object. 对于事件日志, Data元素包含转义的 XML 数据。In the case of event logs, the Data element contains escaped XML data. 如果是数据日志, 元素将Data包含未转义的数据。In the case of data logs, the Data element contains unescaped data. 数据日志输出使用ToString传入的数据对象的方法。The data log output uses the ToString method of the passed-in data objects.
Event NoneNone 始终存在。Always present. 此元素包含跟踪事件。This element contains a trace event.
EventData NoneNone 为事件日志提供。Present for event logs. 此元素表示参数输入 (message, args)。This element represents parameter input (message, args). 它包含Data使用通过TraceEvent调用方法创建的转义 XML 数据的元素。It contains Data elements with escaped XML data that is created by calling the TraceEvent method.
EventID NoneNone 始终存在。Always present. 此元素表示参数输入 (id)。This element represents parameter input (id).
Execution ProcessID 取决于TraceOutputOptions属性中是否存在ProcessId该标志。Depends on the presence of the ProcessId flag in the TraceOutputOptions property. 属性在中指定。 TraceEventCache ProcessIDThe ProcessID attribute is specified in the TraceEventCache. 在 Microsoft Windows 98 和 Windows Millennium Edition 操作系统上, 如果ProcessID大于 2147483647, 则表示负数, 并且应转换为获取正确的进程标识符。On the Microsoft Windows 98 and Windows Millennium Edition operating systems, if ProcessID is larger than 2,147,483,647, it is a positive representation of a negative number and should be converted to obtain the correct process identifier.
ThreadID 存在时ProcessID显示。Present when ProcessID is present. 属性在中指定。 TraceEventCache ThreadIDThe ThreadID attribute is specified in the TraceEventCache.
Level NoneNone 始终存在。Always present. 此元素表示参数输入 (的数值eventType)。This element represents parameter input (the numeric value of eventType). 大于255的参数值将输出为级别 8, 这表示TraceEventType.InformationParameter values that are larger than 255 are output as a level 8, which represents TraceEventType.Information. 跟踪事件类型Critical ErrorInformation、、和Verbose分别作为级别1、2、4、8和10的输出。 WarningTrace event types Critical, Error, Warning, Information, and Verbose are output as levels 1, 2, 4, 8, and 10, respectively.
LogicalOperationStack NoneNone 取决于TraceOutputOptions属性中是否存在LogicalOperationStack该标志。Depends on the presence of the LogicalOperationStack flag in the TraceOutputOptions property. 只能存在一个逻辑操作。Only one logical operation can exist. 因此, 这些值在LogicalOperation LogicalOperationStack元素下作为节点写入。Therefore, the values are written as LogicalOperation nodes under the LogicalOperationStack element.
OpCode NoneNone 当大于Level 255 时存在。Present when Level is greater than 255. 此元素表示数值大于255的跟踪事件类型。This element represents Trace event types that have numeric values greater than 255. Start、、、或Transfer分别输出为级别1、2、4、8和10。 Stop Suspend ResumeStart, Stop, Suspend, Resume, or Transfer are output as levels 1, 2, 4, 8, and 10, respectively.
Provider GUID 始终存在。Always present. 始终为空。Always empty.
RenderingInfo Culture 始终存在。Always present. 此属性表示事件类型的资源字符串。This attribute represents a resource string for the event type. 它始终为 "en-us\"。It is always "en-EN\".
System Name 始终存在。Always present.
TimeCreated SystemTime 取决于TraceOutputOptions属性中是否存在DateTime该标志。Depends on the presence of the DateTime flag in the TraceOutputOptions property. 时间是TraceEventCache.DateTime属性的值。The time is the value of the TraceEventCache.DateTime property. 此属性表示为协调世界时This property is expressed as Coordinated Universal Time
TimeStamp NoneNone 取决于TraceOutputOptions属性中是否存在Timestamp该标志。Depends on the presence of the Timestamp flag in the TraceOutputOptions property. 此元素在中TraceEventCache指定。This element is specified in the TraceEventCache.
UserData NoneNone 为数据日志提供。Present for data logs. 此元素包含Data TraceData来自方法的、用户提供的非转义数据的元素。This element contains Data elements with unescaped, user-provided data from a TraceData method.

下表显示了在 XML 输出中转义的字符。The following table shows the characters that are escaped in the XML output. 转义发生在除UserData元素之外的所有元素和属性中, 该元素包含用户提供的非转义数据。Escaping occurs in all the elements and attributes except for the UserData element, which contains user-provided, unescaped data. 元素是对TraceData方法的调用的结果。 UserDataThe UserData element is a result of calls to the TraceData method.

转义字符Escaped character Value
& &
< <
> >
"" "
|'
0xD0xD &#xD;&#xD;
0xA0xA &#xA;&#xA;

构造函数

EventSchemaTraceListener(String)

通过将指定文件用作调试和跟踪输出的接收方来初始化 EventSchemaTraceListener 类的新实例。Initializes a new instance of the EventSchemaTraceListener class, using the specified file as the recipient of debugging and tracing output.

EventSchemaTraceListener(String, String)

通过将指定文件用作调试和跟踪输出的接收方,来初始化具有指定名称的 EventSchemaTraceListener 类的新实例。Initializes a new instance of the EventSchemaTraceListener class with the specified name, using the specified file as the recipient of debugging and tracing output.

EventSchemaTraceListener(String, String, Int32)

通过将指定文件用作调试和跟踪输出的接收方,来初始化具有指定名称和指定缓冲区大小的 EventSchemaTraceListener 类的新实例。Initializes a new instance of the EventSchemaTraceListener class with the specified name and specified buffer size, using the specified file as the recipient of debugging and tracing output.

EventSchemaTraceListener(String, String, Int32, TraceLogRetentionOption)

通过将具有指定日志保留策略的指定文件用作调试和跟踪输出的接收方,来初始化具有指定名称和指定缓冲区大小的 EventSchemaTraceListener 类的新实例。Initializes a new instance of the EventSchemaTraceListener class with the specified name and specified buffer size, using the specified file with the specified log retention policy as the recipient of the debugging and tracing output.

EventSchemaTraceListener(String, String, Int32, TraceLogRetentionOption, Int64)

通过将具有指定日志保留策略和最大大小的指定文件用作调试和跟踪输出的接收方,来初始化具有指定名称和缓冲区大小的 EventSchemaTraceListener 类的新实例。Initializes a new instance of the EventSchemaTraceListener class with the specified name and specified buffer size, using the specified file with the specified log retention policy and maximum size as the recipient of the debugging and tracing output.

EventSchemaTraceListener(String, String, Int32, TraceLogRetentionOption, Int64, Int32)

通过将具有指定日志保留策略、最大大小和文件计数的指定文件用作调试和跟踪输出的接收方,来初始化具有指定名称和指定缓冲区大小的 EventSchemaTraceListener 类的新实例。Initializes a new instance of the EventSchemaTraceListener class with the specified name and specified buffer size, using the specified file with the specified log retention policy, maximum size, and file count as the recipient of the debugging and tracing output.

属性

Attributes

获取应用程序配置文件中定义的自定义跟踪侦听器特性。Gets the custom trace listener attributes defined in the application configuration file.

(继承自 TraceListener)
BufferSize

获取输出缓冲区的大小。Gets the size of the output buffer.

Filter

获取或设置跟踪侦听器的跟踪筛选器。Gets or sets the trace filter for the trace listener.

(继承自 TraceListener)
IndentLevel

获取或设置缩进级别。Gets or sets the indent level.

(继承自 TraceListener)
IndentSize

获取或设置缩进的空格数。Gets or sets the number of spaces in an indent.

(继承自 TraceListener)
IsThreadSafe

获取一个值,该值指示跟踪侦听器是否是线程安全的。Gets a value indicating whether the trace listener is thread safe.

MaximumFileSize

获取日志文件的最大大小。Gets the maximum size of the log file.

MaximumNumberOfFiles

获取日志文件最大数。Gets the maximum number of log files.

Name

获取或设置此 TraceListener 的名称。Gets or sets a name for this TraceListener.

(继承自 TraceListener)
NeedIndent

获取或设置一个值,该值指示是否缩进输出。Gets or sets a value indicating whether to indent the output.

(继承自 TraceListener)
TraceLogRetentionOption

获取该文件的跟踪日志保留选项。Gets the trace log retention option for the file.

TraceOutputOptions

获取或设置跟踪输出选项。Gets or sets the trace output options.

(继承自 TraceListener)
Writer

获取或设置写入日志文件的基础文本编写器。Gets or sets the underlying text writer that writes to the log file.

方法

Close()

关闭该侦听器的日志文件,以使其不再接收跟踪或调试输出。Closes the log file for this listener so that it no longer receives tracing or debugging output.

CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(继承自 MarshalByRefObject)
Dispose()

释放 TraceListener 使用的所有资源。Releases all resources used by the TraceListener.

(继承自 TraceListener)
Dispose(Boolean)

处置此 TextWriterTraceListener 对象。Disposes this TextWriterTraceListener object.

(继承自 TextWriterTraceListener)
Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
Fail(String)

实现 TraceListener 类时,向所创建的侦听器发出错误信息。Emits an error message to the listener you create when you implement the TraceListener class.

(继承自 TraceListener)
Fail(String, String)

将包含基本错误消息和详细错误消息的错误信息写入日志文件。Writes error information, including a basic error message and a detailed error message, to the log file.

Flush()

导致缓冲数据写入该侦听器的日志。Causes buffered data to be written to the log for this listener.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(继承自 MarshalByRefObject)
GetSupportedAttributes()

获取跟踪侦听器支持的自定义 XML 配置特性。Gets the custom XML configuration attributes that the trace listener supports.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(继承自 MarshalByRefObject)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 MarshalByRefObject)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)
TraceData(TraceEventCache, String, TraceEventType, Int32, Object)

将跟踪信息、单个数据对象和事件信息写入日志文件。Writes trace information, a single data object, and event information to the log file.

TraceData(TraceEventCache, String, TraceEventType, Int32, Object[])

将跟踪信息、多个数据对象和事件信息写入日志文件。Writes trace information, multiple data objects, and event information to the log file.

TraceEvent(TraceEventCache, String, TraceEventType, Int32)

向特定于侦听器的输出写入跟踪和事件信息。Writes trace and event information to the listener specific output.

(继承自 TraceListener)
TraceEvent(TraceEventCache, String, TraceEventType, Int32, String)

将跟踪信息、消息和事件信息写入日志文件。Writes trace information, a message, and event information to the log file.

TraceEvent(TraceEventCache, String, TraceEventType, Int32, String, Object[])

将跟踪信息、格式化消息和事件信息写入日志文件。Writes trace information, a formatted message, and event information to the log file.

TraceTransfer(TraceEventCache, String, Int32, String, Guid)

将跟踪信息(包括相关活动的标识)、消息和事件信息写入日志文件。Writes trace information, including the identity of a related activity, a message, and event information, to the log file.

Write(Object)

实现 ToString() 类时,向所创建的侦听器写入对象的 TraceListener 方法值。Writes the value of the object's ToString() method to the listener you create when you implement the TraceListener class.

(继承自 TraceListener)
Write(Object, String)

实现 ToString() 类时,向所创建的侦听器写入类别名称和对象的 TraceListener 方法值。Writes a category name and the value of the object's ToString() method to the listener you create when you implement the TraceListener class.

(继承自 TraceListener)
Write(String)

将消息写入日志文件,且不提供任何其他上下文信息。Writes a message to the log file without providing any additional context information.

Write(String, String)

实现 TraceListener 类时,向所创建的侦听器写入类别名称和消息。Writes a category name and a message to the listener you create when you implement the TraceListener class.

(继承自 TraceListener)
WriteIndent()

实现此类时,向所创建的侦听器写入缩进,并将 NeedIndent 属性重置为 falseWrites the indent to the listener you create when you implement this class, and resets the NeedIndent property to false.

(继承自 TraceListener)
WriteLine(Object)

实现 ToString() 类时,向所创建的侦听器写入对象的 TraceListener 方法值,后跟行结束符。Writes the value of the object's ToString() method to the listener you create when you implement the TraceListener class, followed by a line terminator.

(继承自 TraceListener)
WriteLine(Object, String)

实现 ToString() 类时,向所创建的侦听器写入类别名称和对象的 TraceListener 方法值,后跟行结束符。Writes a category name and the value of the object's ToString() method to the listener you create when you implement the TraceListener class, followed by a line terminator.

(继承自 TraceListener)
WriteLine(String)

将后跟当前行终止符的消息写入日志文件,且不提供任何其他上下文信息。Writes a message followed by the current line terminator to the log file without providing any additional context information.

WriteLine(String, String)

实现 TraceListener 类时,向所创建的侦听器写入类别名称和消息,后跟行结束符。Writes a category name and a message to the listener you create when you implement the TraceListener class, followed by a line terminator.

(继承自 TraceListener)

适用于