Editare

Partajați prin


FileLogTraceListener.TraceData Method

Definition

Writes trace data to the output file.

Overloads

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

Writes trace information, a data object, and event information to the output file or stream.

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

Writes trace information, an array of data objects, and event information to the output file or stream.

Remarks

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

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

Writes trace information, a data object, and event information to the output file or stream.

public:
 override void TraceData(System::Diagnostics::TraceEventCache ^ eventCache, System::String ^ source, System::Diagnostics::TraceEventType eventType, int id, System::Object ^ data);
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

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

source
String

A name of the trace source that invoked this method.

eventType
TraceEventType

One of the TraceEventType enumeration values.

id
Int32

A numeric identifier for the event.

data
Object

The trace data to emit.

Remarks

This method:

  1. Formats the data and context information for output.

  2. Creates a new log file, if necessary.

  3. Writes the information to the log file.

For more information on creating new log files, see FullLogFileName.

The following table lists the output fields in the order they appear. The fields are delimited by the string that the Delimiter property specifies, and are followed by a line terminator.

Field Output condition Description
source Always The value of name.
severity Always The enumeration-value name of eventType.
id Always The string representation of id.
message Always The string representation of data.
callStack When the Callstack flag is set in the TraceOutputOptions property. The Callstack property of eventCache.
CorrelationID When the LogicalOperationStack flag is set in the TraceOutputOptions property. The ThreadId property of eventCache.
DateTime When the DateTime flag is set in the TraceOutputOptions property. The string representation of the DateTime property of eventCache. The invariant culture is used for the string conversion.
ProcessID When the ProcessId flag is set in the TraceOutputOptions property. The string representation of the ProcessId property of eventCache. The invariant culture is used for the string conversion.
ThreadID When the ThreadId flag is set in the TraceOutputOptions property. The ThreadId property of eventCache.
Timestamp When the Timestamp flag is set in the TraceOutputOptions property. The string representation of the Timestamp property of eventCache. The invariant culture is used for the string conversion.
HostName When the IncludeHostName property is True. The name of the computer.

See also

Applies to

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

Writes trace information, an array of data objects, and event information to the output file or stream.

public:
 override void TraceData(System::Diagnostics::TraceEventCache ^ eventCache, System::String ^ source, System::Diagnostics::TraceEventType eventType, int id, ... cli::array <System::Object ^> ^ data);
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

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

source
String

The name of the trace source that invoked this method.

eventType
TraceEventType

One of the TraceEventType enumeration values.

id
Int32

A numeric identifier for the event.

data
Object[]

An array of objects to emit as data.

Remarks

This method:

  1. Formats the data and context information for output,

  2. Creates a new log file, if necessary,

  3. Writes the information to the log file.

For more information on creating new log files, see FullLogFileName.

This table lists the output fields in the order they appear. The fields are delimited by the string that the Delimiter property specifies, and are followed by a line terminator.

Field Output condition Description
source Always The value of name.
severity Always The enumeration-value name of eventType.
id Always The string representation of id.
message Always The string consisting of the string representation of each element in data, each separated by Delimiter.
callStack When the Callstack flag is set in the TraceOutputOptions property. The Callstack property of eventCache.
CorrelationID When the LogicalOperationStack flag is set in the TraceOutputOptions property. The ThreadId property of eventCache.
DateTime When the DateTime flag is set in the TraceOutputOptions property. The string representation of the DateTime property of eventCache. The invariant culture is used for the string conversion.
ProcessID When the ProcessId flag is set in the TraceOutputOptions property. The string representation of the ProcessId property of eventCache. The invariant culture is used for the string conversion.
ThreadID When the ThreadId flag is set in the TraceOutputOptions property. The ThreadId property of eventCache.
Timestamp When the Timestamp flag is set in the TraceOutputOptions property. The string representation of the Timestamp property of eventCache. The invariant culture is used for the string conversion.
HostName When the IncludeHostName property is True. The name of the computer.

See also

Applies to