EventLogTraceListener.TraceData EventLogTraceListener.TraceData EventLogTraceListener.TraceData EventLogTraceListener.TraceData Method

Definition

Writes trace data to the event log.

Overloads

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

Writes trace information, a data object, and event information to the event log.

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

Writes trace information, an array of data objects, and event information to the event log.

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

Writes trace information, a data object, and event information to the event log.

public:
 override void TraceData(System::Diagnostics::TraceEventCache ^ eventCache, System::String ^ source, System::Diagnostics::TraceEventType eventType, int id, System::Object ^ data);
[System.Runtime.InteropServices.ComVisible(false)]
public override void TraceData (System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, object data);
override this.TraceData : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * obj -> unit
Public Overrides Sub TraceData (eventCache As TraceEventCache, source As String, eventType As TraceEventType, id As Integer, data As Object)
Parameters
eventCache
TraceEventCache TraceEventCache TraceEventCache TraceEventCache

An object that contains the current process ID, thread ID, and stack trace information.

source
String String String String

A name used to identify the output; typically the name of the application that generated the trace event.

severity
TraceEventType TraceEventType TraceEventType TraceEventType

One of the enumeration values that specifies the type of event that has caused the trace.

id
Int32 Int32 Int32 Int32

A numeric identifier for the event. The combination of source and id uniquely identifies an event.

data
Object Object Object Object

A data object to write to the output file or stream.

Exceptions

source is not specified.

-or-

The log entry string exceeds 32,766 characters.

Remarks

Important

The TraceData methods are not intended to be called by application code. They are called by methods of the Debug, Trace, and TraceSource classes to output trace data.

The TraceData method, like the TraceEvent method is intended for automated tools but also allows the attaching of additional objects, for example an exception instance, to the trace.

The eventCache and source parameters are used to determine if the event should be traced. id is used to create an EventInstance object and the TraceEventType is equated to an EventLogEntryType for the EntryType property. The EventInstance is written to the event log with the data object, formatted as a string, using the WriteEvent method.

Note

The maximum value of the id parameter is 65,535. If the id value specified is greater than 65,535, the maximum value is used.

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

Writes trace information, an array of data objects, and event information to the event log.

public:
 override void TraceData(System::Diagnostics::TraceEventCache ^ eventCache, System::String ^ source, System::Diagnostics::TraceEventType eventType, int id, ... cli::array <System::Object ^> ^ data);
[System.Runtime.InteropServices.ComVisible(false)]
public override void TraceData (System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, params object[] data);
override this.TraceData : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * obj[] -> unit
Public Overrides Sub TraceData (eventCache As TraceEventCache, source As String, eventType As TraceEventType, id As Integer, ParamArray data As Object())
Parameters
eventCache
TraceEventCache TraceEventCache TraceEventCache TraceEventCache

An object that contains the current process ID, thread ID, and stack trace information.

source
String String String String

A name used to identify the output; typically the name of the application that generated the trace event.

severity
TraceEventType TraceEventType TraceEventType TraceEventType

One of the enumeration values that specifies the type of event that has caused the trace.

id
Int32 Int32 Int32 Int32

A numeric identifier for the event. The combination of source and id uniquely identifies an event.

data
Object[]

An array of data objects.

Exceptions

source is not specified.

-or-

The log entry string exceeds 32,766 characters.

Remarks

Important

The TraceData methods are not intended to be called by application code. They are called by methods of the Debug, Trace, and TraceSource classes to output trace data.

The TraceData method, like the TraceEvent method is intended for automated tools but also allows the attaching of additional objects, for example an exception instance, to the trace.

The severity and id parameter data is used to create an EventInstance object, which is written to the event log with the data from the array of data objects.

The eventCache and source parameters are used to determine if the event should be traced. id is used to create an EventInstance object and the TraceEventType is equated to an EventLogEntryType for the EntryType property. The EventInstance is written to the event log with the data object array, formatted as a string array, using the WriteEvent method.

Note

The maximum value of the id parameter is 65,535. If the id value specified is greater than 65,535, the maximum value is used.

Applies to