EventLogTraceListener.TraceData Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Writes trace data to the event log.
Overloads
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[]) |
Writes trace information, an array of data objects, and event information to the event log. |
TraceData(TraceEventCache, String, TraceEventType, Int32, Object)
- Source:
- EventLogTraceListener.cs
- Source:
- EventLogTraceListener.cs
- Source:
- EventLogTraceListener.cs
- Source:
- EventLogTraceListener.cs
- Source:
- EventLogTraceListener.cs
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 severity, int id, System::Object ^ data);
[System.Runtime.InteropServices.ComVisible(false)]
public override void TraceData (System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType severity, int id, object data);
[<System.Runtime.InteropServices.ComVisible(false)>]
override this.TraceData : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * obj -> unit
Public Overrides Sub TraceData (eventCache As TraceEventCache, source As String, severity As TraceEventType, id As Integer, data As Object)
Parameters
- eventCache
- TraceEventCache
An object that contains the current process ID, thread ID, and stack trace information.
- source
- String
A name used to identify the output; typically the name of the application that generated the trace event.
- severity
- TraceEventType
One of the enumeration values that specifies the type of event that has caused the trace.
- id
- Int32
A numeric identifier for the event. The combination of source
and id
uniquely identifies an event.
- data
- Object
A data object to write to the output file or stream.
- Attributes
Exceptions
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.
Applies to
TraceData(TraceEventCache, String, TraceEventType, Int32, Object[])
- Source:
- EventLogTraceListener.cs
- Source:
- EventLogTraceListener.cs
- Source:
- EventLogTraceListener.cs
- Source:
- EventLogTraceListener.cs
- Source:
- EventLogTraceListener.cs
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 severity, 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 severity, int id, params object[] data);
[<System.Runtime.InteropServices.ComVisible(false)>]
override this.TraceData : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * obj[] -> unit
Public Overrides Sub TraceData (eventCache As TraceEventCache, source As String, severity As TraceEventType, id As Integer, ParamArray data As Object())
Parameters
- eventCache
- TraceEventCache
An object that contains the current process ID, thread ID, and stack trace information.
- source
- String
A name used to identify the output; typically the name of the application that generated the trace event.
- severity
- TraceEventType
One of the enumeration values that specifies the type of event that has caused the trace.
- id
- Int32
A numeric identifier for the event. The combination of source
and id
uniquely identifies an event.
- data
- Object[]
An array of data objects.
- Attributes
Exceptions
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.