Επεξεργασία

Κοινή χρήση μέσω


EventSchemaTraceListener Constructors

Definition

Initializes a new instance of the EventSchemaTraceListener class.

Overloads

EventSchemaTraceListener(String)

Initializes a new instance of the EventSchemaTraceListener class, using the specified file as the recipient of debugging and tracing output.

EventSchemaTraceListener(String, String)

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)

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)

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)

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)

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)

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)

Parameters

fileName
String

The path for the log file.

Examples

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"))

Remarks

By default, one file of unrestricted size is logged.

Applies to

EventSchemaTraceListener(String, String)

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)

Parameters

fileName
String

The path for the log file.

name
String

The name of the listener.

Examples

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"))

Applies to

EventSchemaTraceListener(String, String, Int32)

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)

Parameters

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.

Examples

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))

Remarks

For performance considerations, bufferSize should be a multiple of 1024 bytes.

Applies to

EventSchemaTraceListener(String, String, Int32, TraceLogRetentionOption)

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)

Parameters

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

One of the TraceLogRetentionOption values.

Examples

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))

Remarks

For performance considerations, bufferSize should be a multiple of 1024 bytes.

Applies to

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

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)

Parameters

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

One of the TraceLogRetentionOption values.

maximumFileSize
Int64

The maximum file size, in bytes.

Exceptions

maximumFileSize is a negative number or less than bufferSize.

-or-

bufferSize is a negative number.

Examples

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))

Remarks

For performance considerations, bufferSize and maximumFileSize should be multiples of 1024 bytes. maximumFileSize is not an absolute value, it is a threshold which can be exceeded up to the size of the last message.

Applies to

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

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)

Parameters

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

One of the TraceLogRetentionOption values.

maximumFileSize
Int64

The maximum file size, in bytes.

maximumNumberOfFiles
Int32

The maximum number of output log files.

Exceptions

maximumFileSize is a negative number or less than bufferSize.

-or-

maximumNumberOfFiles is less than 1, and logRetentionOption is LimitedSequentialFiles.

-or-

maximumNumberOfFiles is less than 2, and logRetentionOption is LimitedCircularFiles.

-or-

bufferSize is a negative number.

Examples

The following code example demonstrates how to use the EventSchemaTraceListener constructor. This 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))

Remarks

For performance considerations, bufferSize and maximumFileSize should be multiples of 1024 bytes. maximumFileSize is not an absolute value; it is a threshold that can be exceeded up to the size of the last message.

Applies to