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 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 The DefaultTraceListener is a that is, by default, present in all applications.

The DefaultTraceListener is a that is present (by default) in all applications. All messages sent through (and related methods) will be sent to the DefaultTraceListener, as well as any other TraceListeners in the collection.

There are three ways to view the output of the DefaultTraceListener:

Set the property. This will cause all output to be appended to the specified log file.

This is the only behavior that is consistent across both .NET and Mono platforms.

The LogFileName property can be set either through code, or in the application .config file, by setting the (XPath) /configuration/system.diagnostics/assert/@logfilename attribute. For example:

`<configuration> <system.diagnostics> <assert logfilename="where I want TraceListener messages to go"/> </system.diagnostics> </configuration>`
On Windows, messages are also displayed using the OutputDebugString API. (Look it up on MSDN.) Messages are automatically displayed in the debugger if the program is being debugged. If the program isn't being debugged, a program such as DebugView, available from http://www.sysinternals.com can be used to view the output.

On Unix, the LogFileName property is used, with additional behavior available depending on the MONO_TRACE_LISTENER environment variable.

If MONO_TRACE_LISTENER isn't set or is empty, messages are ignored.

Otherwise, the value in MONO_TRACE_LISTENER must match the following BNF-like grammar:

`MONO_TRACE_LISTENER := <builtin-locations/> | <file-name/> <builtin-locations/> := ( "Console.Out" | "Console.Error" ) ( ':' <prefix/> )? <prefix/> := any string of characters <file-name/> := any valid file name`

Console.Out corresponds to Standard Output (/dev/stdout), and Console.Error corresponds to Standard Error (/dev/stderr). This also means that you cannot create a filename of Console.Out or Console.Error.

The "prefix" is a string of characters that appears before each message printed to Standard Output or Standard Error. It is not available for filename settings. It is present so that it is easier to distinguish between normal program output and the diagnostic messages.

For example, given the following sample program:

`using System; using System.Diagnostics; public class ShowDefaultTraceListener { public static void Main () { Console.WriteLine ("Standard Output message."); Trace.WriteLine ("TraceListener message"); } }`

If MONO_TRACE_LISTENER is set to "Console.Out:++prefix++ ", then the output of the program under Unix would be:

`Standard Output message. ++prefix++ TraceListener message`

The DefaultTraceListener is not complete. MSDN specifies that GUI widgets be used for certain features, such as when is and is called. GUI support is not present, so non-GUI alternatives should be used, such as LogFileName.

The default is "Default". The name can be used to remove TraceListeners.

See for more information on adding and removing TraceListeners.

- Constructor
  Constructs a new instance of the class.
  Constructs a new instance of the class, with a value of Default.
  1.0.5000.0
  2.0.0.0
- Property
  System.Boolean Gets or sets whether a GUI is used for some functionality. This is ignored by Mono. Whether or not a GUI should be used when is called.

  If , calls to should appear in a GUI dialog box.

  This is currently ignored by Mono.

  1.0.5000.0
  2.0.0.0
- Method
  System.Void `` The failure message to display. Writes a failure message.

  Writes a failure message, which is a message that should be displayed in a very visible fashion. If is , the message is displayed in a GUI dialog box, interupting whatever the user might be doing.

  1.0.5000.0
  2.0.0.0
- Method
  System.Void `` `` The short message to display. The detailed message to display. Writes a failure message with detailed information.

  Writes a failure message, which is a message that should be displayed in a very visible fashion, along with detailed information. If is , the message is displayed in a GUI dialog box, interupting whatever the user might be doing.

  1.0.5000.0
  2.0.0.0
- Property
  System.String Gets or sets the name of a log file to write trace and debug messages to. To be added: an object of type 'string' When set to a non-empty string, all debug and trace messages are appended to the specified file. 1.0.5000.0 2.0.0.0
- Method
  System.Void `` The message to display. Writes .

  Writes to a number of potential locations.

  See for location information.

  1.0.5000.0
  2.0.0.0
- Method
  System.Void `` The message to display. Writes , followed by .

  Writes , followed by , to a number of potential locations.

  See for location information.

  1.0.5000.0
  2.0.0.0