EventLogTraceListener::TraceEvent Method (TraceEventCache^, String^, TraceEventType, Int32, String^)
Writes trace information, a message, and event information to the event log.
Assembly: System (in System.dll)
public: [ComVisibleAttribute(false)] virtual void TraceEvent( TraceEventCache^ eventCache, String^ source, TraceEventType severity, int id, String^ message ) override
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.
- message
-
Type:
System::String^
The trace message.
| Exception | Condition |
|---|---|
| ArgumentException | source is not specified. -or- The log entry string exceeds 32,766 characters. |
Important |
|---|
The TraceEvent methods are not intended to be called by application code. These methods are called by methods of the Debug, Trace, and TraceSource classes to write trace data. |
The TraceEvent method is intended to trace events that can be processed automatically by tools. For example a monitoring tool can notify an administrator if a specific event is traced by a specific source.
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 message data 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. |
Available since 2.0

