Brett Romero <firstname.lastname@example.org> wrote:
I tried datetime but that didn't do anything. Nothing is outputting in
Could you post a short but complete program which demonstrates the
See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
Here's some sample code which uses the same configuration as yours:
static void Main()
Here's the result:
test Information: 0 : Hello
(Of course, you need to compile with TRACE defined.)
I'd also like to output only certain code. It seems to be outputting
all errors. In other words, how do I configure a Trace in the
app.config file then reference it in code the same way I do Debug? For
example, the trace may be named myTrace and I can do
myTrace.WriteLine(). The log file will contain only entries that I
explicitly reference via myTrace.
You can use Trace.Listeners["myTrace"] to get a specific TraceListener,
but I don't think you would normally do that. (TraceListener doesn't
seem to encourage you to use it directly.)
Perhaps you should look at other logging frameworks, such as Log4Net?
Jon Skeet - <email@example.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too