The following program does not print the text "This is a trace". There is no app.config.
My question is, how can I modify the following code (and only the code, not any configuration files) such that messages passed in calls to t.TraceEvent appear in the Console window
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
Trace.Listeners.Add(
new TextWriterTraceListener(Console.Out)
);
TraceSource t = new TraceSource("Test");
t.Listeners.AddRange(Trace.Listeners);
t.TraceEvent(TraceEventType.Critical, 1, "This is a trace");
Console.Write("Press enter to quit");
Console.ReadLine();
}
}
}