System [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.3300.0 1.0.5000.0 2.0.0.0 4.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Diagnostics.TraceListener

An instance of this can be added to the , , or collections to send output from tracing or debugging to an . You can add the instance in your code or specify it in the application configuration file. To add an using an application configuration file, edit the file that corresponds to the name of your application or the app.config file in a vsprvslong project. In this file, insert an element for a type.

The following example adds a object named myListener to the collection. The parameter specifies the name of the event log source that is to be passed to the constructor.

`<configuration> <system.diagnostics> <trace autoflush="false" indentsize="4"> <listeners> <add name="myListener" type="System.Diagnostics.EventLogTraceListener" initializeData="TraceListenerLog" /> </listeners> </trace> </system.diagnostics> </configuration>`

For more information about how to add trace listeners in the application configuration file, see <listeners> element or <listeners> element for <source>.

If the for the event log that is associated with the instance does not exist, a new event source is created. To create an event source in Windows Vista, Windows XP Professional, or Windows Server 2003, you must have administrative privileges.

The reason for this requirement is that all event logs, including security, must be searched to determine whether the event source is unique. In Windows Vista, users do not have permission to access the security log; therefore, a is thrown.

In Windows Vista, User Account Control (UAC) determines the privileges of a user. If you are a member of the Built-in Administrators group, you are assigned two run-time access tokens: a standard user access token and an administrator access token. By default, you are in the standard user role. To execute the code that accesses the security log, you must first elevate your privileges from standard user to administrator. You can do this when you start an application by right-clicking the application icon and indicating that you want to run as an administrator.

The class provides the property to get or set the event log that receives the tracing or debugging output, and the property to hold the name of the .

The method closes the event log so it no longer receives tracing or debugging output. The and methods write a message to the event log.

To avoid the possibility of writing large amounts of data to the event log, the does not output the optional trace data specified by the property.

Provides a simple listener that directs tracing or debugging output to an .

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  To be added

  Initializes a new instance of the class without a trace listener.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  To be added

  Initializes a new instance of the class using the specified event log.

  The event log to write to.
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  To be added

  Initializes a new instance of the class using the specified source.

  The name of an existing event log source.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void To be added

  Closes the event log so that it no longer receives tracing or debugging output.

- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` To be added: an object of type 'bool' To be added To be added
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Diagnostics.EventLog To be added: an object of type 'EventLog' To be added

  Gets or sets the event log to write to.

- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.String To be added: an object of type 'string'

  This property defaults to the source name of the event log.

  Gets or sets the name of this .

- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void `` `` `` `` `` To be added.

  The methods are not intended to be called by application code. They are called by methods of the , , and classes to output trace data.

  The method, like the method is intended for automated tools but also allows the attaching of additional objects, for example an exception instance, to the trace.

  The and parameters are used to determine if the event should be traced. is used to create an object and the is equated to an for the property. The is written to the event log with the object, formatted as a string, using the method.

  The maximum value of the parameter is 65,535. If the value specified is greater than 65,535, the maximum value is used.

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

  An object that contains the current process ID, thread ID, and stack trace information. A name used to identify the output; typically the name of the application that generated the trace event. A numeric identifier for the event. The combination of and uniquely identifies an event. A data object to write to the output file or stream.
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void `` `` `` `` `System.ParamArray` To be added.

  The methods are not intended to be called by application code. They are called by methods of the , , and classes to output trace data.

  The method, like the method is intended for automated tools but also allows the attaching of additional objects, for example an exception instance, to the trace.

  The and parameter data is used to create an object, which is written to the event log with the data from the array of data objects.

  The and parameters are used to determine if the event should be traced. is used to create an object and the is equated to an for the property. The is written to the event log with the object array, formatted as a string array, using the method.

  The maximum value of the parameter is 65,535. If the value specified is greater than 65,535, the maximum value is used.

  Writes trace information, an array of data objects, and event information to the event log.

  An object that contains the current process ID, thread ID, and stack trace information. A name used to identify the output; typically the name of the application that generated the trace event. A numeric identifier for the event. The combination of and uniquely identifies an event. An array of data objects.
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void `` `` `` `` `` To be added.

  The methods are not intended to be called by application code. These methods are called by methods of the , , and classes to write trace data.

  The 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 and parameters are used to determine if the event should be traced. is used to create an object and the is equated to an for the property. The is written to the event log with the data using the method.

  The maximum value of the parameter is 65,535. If the value specified is greater than 65,535, the maximum value is used.

  Writes trace information, a message, and event information to the event log.

  An object that contains the current process ID, thread ID, and stack trace information. A name used to identify the output; typically the name of the application that generated the trace event. A numeric identifier for the event. The combination of and uniquely identifies an event. The trace message.
- Method
  2.0.0.0
  4.0.0.0
  System.Runtime.InteropServices.ComVisible(false)
  System.Void `` `` `` `` `` `System.ParamArray` To be added.

  The methods are not intended to be called by application code. These methods are called by methods of the , , and classes to write trace data.

  The 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 and parameters are used to determine if the event should be traced. is used to create an object and the is equated to an for the property. The is written to the event log, using the method, with the message obtained from the and parameters. The object array is converted to a string using the method, passing the string and array to format the string as the message for the event log.

  The maximum value of the parameter is 65,535. If the value specified is greater than 65,535, the maximum value is used.

  Writes trace information, a formatted array of objects, and event information to the event log.

  An object that contains the current process ID, thread ID, and stack trace information. A name used to identify the output; typically the name of the application that generated the trace event. A numeric identifier for the event. The combination of and uniquely identifies an event. A format string that contains zero or more format items that correspond to objects in the array. An object array containing zero or more objects to format.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` To be added

  Writes a message to the event log for this instance.

  The message to write.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` To be added

  Writes a message to the event log for this instance.

  The message to write.