How to apply a format for trace output

Topics: Logging Application Block
Apr 17, 2008 at 7:08 PM
How can I format the output from Logger.Write() that is captured using the Systems.Diagnostics tracelistener? This specific trace listener does not seem to have any attribute for specifying a formatter (as the other listeners have). The effect is that one single call to Logger.Write() produces many lines in the trace listener (I prefer DbgView).

Argh! Is the only solution to write a custom trace listener?
May 16, 2008 at 11:26 AM
I have exactly the same requirement - was there any follow up to this?
May 16, 2008 at 1:07 PM
Edited May 16, 2008 at 1:08 PM
duplicate:repost
May 16, 2008 at 2:56 PM

Hi,

I assume you're talking about the s DefaultTraceListener (there are many trace listeners in the System.Diagnostics namespace). This trace listener, as all other trace listeners from System.Diagnostics, can't possible know about EntLib's Formatter. Creating a custom trace listener to wrap the default behavior is the way to go. You can extend the class FormattedTraceListenerWrapperBase for this; the FormattedEventLogTraceListener

Regards,
Fernando

 


AtleH wrote:
How can I format the output from Logger.Write() that is captured using the Systems.Diagnostics tracelistener? This specific trace listener does not seem to have any attribute for specifying a formatter (as the other listeners have). The effect is that one single call to Logger.Write() produces many lines in the trace listener (I prefer DbgView).

Argh! Is the only solution to write a custom trace listener?



May 16, 2008 at 5:49 PM
Thanks for the clarification and confirmation.