Export (0) Print
Expand All

EventLogTraceListener.TraceData Method (TraceEventCache, String, TraceEventType, Int32, Object)

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

Namespace:  System.Diagnostics
Assembly:  System (in System.dll)

[ComVisibleAttribute(false)]
public override void TraceData(
	TraceEventCache eventCache,
	string source,
	TraceEventType severity,
	int id,
	Object data
)

Parameters

eventCache
Type: System.Diagnostics.TraceEventCache

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

source
Type: System.String

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

severity
Type: System.Diagnostics.TraceEventType

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

id
Type: System.Int32

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

data
Type: System.Object

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

ExceptionCondition
ArgumentException

source is not specified.

-or-

The log entry string exceeds 32,766 characters.

Important noteImportant

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.

NoteNote

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.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft