Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

FileLogTraceListener::TraceEvent Method (TraceEventCache^, String^, TraceEventType, Int32, String^, array<Object^>^)

 

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

Namespace:   Microsoft.VisualBasic.Logging
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public:
[HostProtectionAttribute(SecurityAction::LinkDemand, Synchronization = true)]
virtual void TraceEvent(
	TraceEventCache^ eventCache,
	String^ source,
	TraceEventType eventType,
	int id,
	String^ format,
	... array<Object^>^ args
) override

Parameters

eventCache
Type: System.Diagnostics::TraceEventCache^

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

source
Type: System::String^

A name of the trace source that invoked this method.

eventType
Type: System.Diagnostics::TraceEventType

One of the TraceEventType enumeration values.

id
Type: System::Int32

A numeric identifier for the event.

format
Type: System::String^

A format string that contains zero or more format items, which correspond to objects in the args array.

args
Type: array<System::Object^>^

An Object array containing zero or more objects to format.

This method:

  1. Formats the data and context information for output.

  2. Creates a new a new log file, if necessary.

  3. Writes the information to the log file.

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

This table lists the output fields in the order in which they appear. The fields are delimited by the string that the Delimiter property specifies, and 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 data in args formatted with the format string and using the invariant culture for string conversions.

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.

.NET Framework
Available since 2.0
Return to top
Show: