EventSchemaTraceListener 构造函数

定义

初始化 EventSchemaTraceListener 类的新实例。Initializes a new instance of the EventSchemaTraceListener class.

重载

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.

EventSchemaTraceListener(String)

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

public:
 EventSchemaTraceListener(System::String ^ fileName);
public EventSchemaTraceListener (string fileName);
new System.Diagnostics.EventSchemaTraceListener : string -> System.Diagnostics.EventSchemaTraceListener
Public Sub New (fileName As String)

参数

fileName
String

日志文件的路径。The path for the log file.

示例

下面的代码示例演示如何使用 EventSchemaTraceListener.EventSchemaTraceListener(String) 构造函数。The following code example demonstrates how to use the EventSchemaTraceListener.EventSchemaTraceListener(String) constructor.

TraceSource ts = new TraceSource("TestSource");
ts.Listeners.Add(new EventSchemaTraceListener("TraceOutput.xml"));
Dim ts As New TraceSource("TestSource")
ts.Listeners.Add(New EventSchemaTraceListener("TraceOutput.xml"))

注解

默认情况下,将记录不受限制大小的一个文件。By default, one file of unrestricted size is logged.

适用于

产品 Introduced

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.

public:
 EventSchemaTraceListener(System::String ^ fileName, System::String ^ name);
public EventSchemaTraceListener (string fileName, string name);
new System.Diagnostics.EventSchemaTraceListener : string * string -> System.Diagnostics.EventSchemaTraceListener
Public Sub New (fileName As String, name As String)

参数

fileName
String

日志文件的路径。The path for the log file.

name
String

侦听器名称。The name of the listener.

示例

下面的代码示例演示如何使用 EventSchemaTraceListener.EventSchemaTraceListener(String, String, Int32) 构造函数。The following code example demonstrates how to use the EventSchemaTraceListener.EventSchemaTraceListener(String, String, Int32) constructor.

TraceSource ts = new TraceSource("TestSource");
ts.Listeners.Add(new EventSchemaTraceListener("TraceOutput.xml", "eventListener"));
Dim ts As New TraceSource("TestSource")
ts.Listeners.Add(New EventSchemaTraceListener("TraceOutput.xml", "eventListener"))

适用于

产品 Introduced

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.

public:
 EventSchemaTraceListener(System::String ^ fileName, System::String ^ name, int bufferSize);
public EventSchemaTraceListener (string fileName, string name, int bufferSize);
new System.Diagnostics.EventSchemaTraceListener : string * string * int -> System.Diagnostics.EventSchemaTraceListener
Public Sub New (fileName As String, name As String, bufferSize As Integer)

参数

fileName
String

日志文件的路径。The path for the log file.

name
String

侦听器名称。The name of the listener.

bufferSize
Int32

输出缓冲区的大小(以字节为单位)。The size of the output buffer, in bytes.

示例

下面的代码示例演示如何使用 EventSchemaTraceListener.EventSchemaTraceListener(String, String, Int32) 构造函数。The following code example demonstrates how to use the EventSchemaTraceListener.EventSchemaTraceListener(String, String, Int32) constructor.

TraceSource ts = new TraceSource("TestSource");
ts.Listeners.Add(new EventSchemaTraceListener("TraceOutput.xml", "eventListener", 65536));
Dim ts As New TraceSource("TestSource")
ts.Listeners.Add(New EventSchemaTraceListener("TraceOutput.xml", "eventListener", 65536))

注解

出于性能考虑, bufferSize 应为1024字节的倍数。For performance considerations, bufferSize should be a multiple of 1024 bytes.

适用于

产品 Introduced

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.

public:
 EventSchemaTraceListener(System::String ^ fileName, System::String ^ name, int bufferSize, System::Diagnostics::TraceLogRetentionOption logRetentionOption);
public EventSchemaTraceListener (string fileName, string name, int bufferSize, System.Diagnostics.TraceLogRetentionOption logRetentionOption);
new System.Diagnostics.EventSchemaTraceListener : string * string * int * System.Diagnostics.TraceLogRetentionOption -> System.Diagnostics.EventSchemaTraceListener
Public Sub New (fileName As String, name As String, bufferSize As Integer, logRetentionOption As TraceLogRetentionOption)

参数

fileName
String

日志文件的路径。The path for the log file.

name
String

侦听器名称。The name of the listener.

bufferSize
Int32

输出缓冲区的大小(以字节为单位)。The size of the output buffer, in bytes.

logRetentionOption
TraceLogRetentionOption

TraceLogRetentionOption 值之一。One of the TraceLogRetentionOption values.

示例

下面的代码示例演示如何使用 EventSchemaTraceListener.EventSchemaTraceListener(String, String, Int32, TraceLogRetentionOption) 构造函数。The following code example demonstrates how to use the EventSchemaTraceListener.EventSchemaTraceListener(String, String, Int32, TraceLogRetentionOption) constructor.

TraceSource ts = new TraceSource("TestSource");
ts.Listeners.Add(new EventSchemaTraceListener("TraceOutput.xml", "eventListener", 65536, TraceLogRetentionOption.LimitedCircularFiles));
Dim ts As New TraceSource("TestSource")
ts.Listeners.Add(New EventSchemaTraceListener("TraceOutput.xml", "eventListener", 65536, TraceLogRetentionOption.LimitedCircularFiles))

注解

出于性能考虑, bufferSize 应为1024字节的倍数。For performance considerations, bufferSize should be a multiple of 1024 bytes.

适用于

产品 Introduced

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.

public:
 EventSchemaTraceListener(System::String ^ fileName, System::String ^ name, int bufferSize, System::Diagnostics::TraceLogRetentionOption logRetentionOption, long maximumFileSize);
public EventSchemaTraceListener (string fileName, string name, int bufferSize, System.Diagnostics.TraceLogRetentionOption logRetentionOption, long maximumFileSize);
new System.Diagnostics.EventSchemaTraceListener : string * string * int * System.Diagnostics.TraceLogRetentionOption * int64 -> System.Diagnostics.EventSchemaTraceListener
Public Sub New (fileName As String, name As String, bufferSize As Integer, logRetentionOption As TraceLogRetentionOption, maximumFileSize As Long)

参数

fileName
String

日志文件的路径。The path for the log file.

name
String

侦听器名称。The name of the listener.

bufferSize
Int32

输出缓冲区的大小(以字节为单位)。The size of the output buffer, in bytes.

logRetentionOption
TraceLogRetentionOption

TraceLogRetentionOption 值之一。One of the TraceLogRetentionOption values.

maximumFileSize
Int64

最大文件大小(以字节为单位)。The maximum file size, in bytes.

例外

maximumFileSize 为负数或小于 bufferSizemaximumFileSize is a negative number or less than bufferSize.

- 或 --or-

bufferSize 为负数。bufferSize is a negative number.

示例

下面的代码示例演示如何使用 EventSchemaTraceListener.EventSchemaTraceListener(String, String, Int32, TraceLogRetentionOption, Int64) 构造函数。The following code example demonstrates how to use the EventSchemaTraceListener.EventSchemaTraceListener(String, String, Int32, TraceLogRetentionOption, Int64) constructor.

TraceSource ts = new TraceSource("TestSource");
ts.Listeners.Add(new EventSchemaTraceListener("TraceOutput.xml", "eventListener", 65536, TraceLogRetentionOption.LimitedCircularFiles, 20480000));
Dim ts As New TraceSource("TestSource")
ts.Listeners.Add(New EventSchemaTraceListener("TraceOutput.xml", "eventListener", 65536, TraceLogRetentionOption.LimitedCircularFiles, 20480000))

注解

出于性能考虑, bufferSize maximumFileSize 应为1024字节的倍数。For performance considerations, bufferSize and maximumFileSize should be multiples of 1024 bytes. maximumFileSize 不是绝对值,它是一个可超出最后一条消息大小的阈值。maximumFileSize is not an absolute value, it is a threshold which can be exceeded up to the size of the last message.

适用于

产品 Introduced

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.

public:
 EventSchemaTraceListener(System::String ^ fileName, System::String ^ name, int bufferSize, System::Diagnostics::TraceLogRetentionOption logRetentionOption, long maximumFileSize, int maximumNumberOfFiles);
public EventSchemaTraceListener (string fileName, string name, int bufferSize, System.Diagnostics.TraceLogRetentionOption logRetentionOption, long maximumFileSize, int maximumNumberOfFiles);
new System.Diagnostics.EventSchemaTraceListener : string * string * int * System.Diagnostics.TraceLogRetentionOption * int64 * int -> System.Diagnostics.EventSchemaTraceListener
Public Sub New (fileName As String, name As String, bufferSize As Integer, logRetentionOption As TraceLogRetentionOption, maximumFileSize As Long, maximumNumberOfFiles As Integer)

参数

fileName
String

日志文件的路径。The path for the log file.

name
String

侦听器名称。The name of the listener.

bufferSize
Int32

输出缓冲区的大小(以字节为单位)。The size of the output buffer, in bytes.

logRetentionOption
TraceLogRetentionOption

TraceLogRetentionOption 值之一。One of the TraceLogRetentionOption values.

maximumFileSize
Int64

最大文件大小(以字节为单位)。The maximum file size, in bytes.

maximumNumberOfFiles
Int32

输出日志文件的最大数。The maximum number of output log files.

例外

maximumFileSize 为负数或小于 bufferSizemaximumFileSize is a negative number or less than bufferSize.

- 或 --or-

maximumNumberOfFiles 小于 1,且 logRetentionOptionLimitedSequentialFilesmaximumNumberOfFiles is less than 1, and logRetentionOption is LimitedSequentialFiles.

- 或 --or-

maximumNumberOfFiles 小于 2,logRetentionOptionLimitedCircularFilesmaximumNumberOfFiles is less than 2, and logRetentionOption is LimitedCircularFiles.

- 或 --or-

bufferSize 为负数。bufferSize is a negative number.

示例

下面的代码示例演示如何使用 EventSchemaTraceListener 构造函数。The following code example demonstrates how to use the EventSchemaTraceListener constructor. 此代码示例是为类提供的更大示例的一部分 EventSchemaTraceListenerThis code example is part of a larger example that is provided for the EventSchemaTraceListener class.

//ts.Listeners.Add(new EventSchemaTraceListener("TraceOutput.xml", "eventListener", 65536, TraceLogRetentionOption.LimitedCircularFiles, 20480000, 2));
ts.Listeners.Add(new EventSchemaTraceListener("TraceOutput.xml", "eventListener"));
ts.Listeners.Add(New EventSchemaTraceListener("TraceOutput.xml", "eventListener", 65536, TraceLogRetentionOption.LimitedCircularFiles, 20480000, 2))

注解

出于性能考虑, bufferSize maximumFileSize 应为1024字节的倍数。For performance considerations, bufferSize and maximumFileSize should be multiples of 1024 bytes. maximumFileSize 不是绝对值;它是一个可超出最后一条消息大小的阈值。maximumFileSize is not an absolute value; it is a threshold that can be exceeded up to the size of the last message.

适用于

产品 Introduced