M
michael sorens
I would like to be able to define a TraceListener in my app.config file whose
Writer is a stream. I understand how to do this in code, but I have not been
successful in getting it to work with the app.config file. I had hoped that I
could just omit the initializeData attribute and then assign a Writer in
code, which would suit my purpose. But it seems that any attempt to access
the TraceSource configuration generates a ConfigurationErrorsException. That
is, if I attempt to assign a Writer like this:
((TextWriterTraceListener)mySource.Listeners["ExperimentalListener"]).Writer = strWriter = new StringWriter();
I get the aforementioned exception.
Is there a way to initialize the Writer to a StringWriter within the
app.config file itself?
[My environment: .NET 2.0, VS2005]
Writer is a stream. I understand how to do this in code, but I have not been
successful in getting it to work with the app.config file. I had hoped that I
could just omit the initializeData attribute and then assign a Writer in
code, which would suit my purpose. But it seems that any attempt to access
the TraceSource configuration generates a ConfigurationErrorsException. That
is, if I attempt to assign a Writer like this:
((TextWriterTraceListener)mySource.Listeners["ExperimentalListener"]).Writer = strWriter = new StringWriter();
I get the aforementioned exception.
Is there a way to initialize the Writer to a StringWriter within the
app.config file itself?
[My environment: .NET 2.0, VS2005]