This project has moved. For the latest updates, please go here.

ConsoleTraceListener Class

Writes to the console output or error stream.


Each event includes the Source, EventType, Id and Message. Depending on
traceOutputOptions, additional lines may be written

For an alternative that uses color to highlight event types and allows a
customised output format see ColoredConsoleTraceListener.

Config Attributes

Attribute Description
initalizeData If false (default) the listener writes to the console output stream; if true the listener writes to the console error stream instead.
traceOutputOptions Are written on separate lines after each trace output.

Example Config

Note: You may need to change the version number of Visual Basic based on the .NET version you are using.

<?xml version="1.0" encoding="utf-8" ?>
      <add name="console"
         type="System.Diagnostics.ConsoleTraceListener" />
      <source name="ExampleSource" switchValue="All">
          <clear />
          <add name="console" />

Example Output

From the Getting Started example:

PS C:\Essential.Diagnostics\Examples> .\Hello.exe
Hello Information: 0 : Hello World!

You can also download the Complete package with examples and see the Console subfolder in the HelloLogging example.

Config Template

<add name="console"

Last edited Mar 27, 2013 at 1:28 AM by sgryphon, version 3


No comments yet.