J
Jim Bancroft
Hi all,
I'm experimenting with custom trace listeners, and wondered if someone
could point me in the right direction. Right now I have a listener which
writes to a text file, as outlined below:
Stream myFile = File.Create("TestFile.txt");
TextWriterTraceListener myTextListener = new
TextWriterTraceListener(myFile);
Trace.Listeners.Add(myTextListener);
The code works, but I'd like to avoid hard-coding the listener type in
my source. I'd like (ideally) to modify app.config and redirect my trace
info to the event log or (with a customized listener) a SQL table if need
be. Can someone suggest a way to do this? I've been reading up on
system.diagnostics tags but I'm not quite sure how best to go about
it....thanks a lot for pointing me in the right direction.
-Jim
I'm experimenting with custom trace listeners, and wondered if someone
could point me in the right direction. Right now I have a listener which
writes to a text file, as outlined below:
Stream myFile = File.Create("TestFile.txt");
TextWriterTraceListener myTextListener = new
TextWriterTraceListener(myFile);
Trace.Listeners.Add(myTextListener);
The code works, but I'd like to avoid hard-coding the listener type in
my source. I'd like (ideally) to modify app.config and redirect my trace
info to the event log or (with a customized listener) a SQL table if need
be. Can someone suggest a way to do this? I've been reading up on
system.diagnostics tags but I'm not quite sure how best to go about
it....thanks a lot for pointing me in the right direction.
-Jim