Custom Trace Listener doesn't use formatters

Topics: Logging Application Block
Jan 9, 2007 at 4:43 PM
Hello,

I've written a custom trace listener to send logs to a web service. However, the messages that I get to log are without any formatting. I've tried different formatters, I've even written my own one, but nothing changes. Any idea why this is happening?

Thank you in advance,
Martin
Jan 9, 2007 at 8:12 PM
Hi Martin -

TraceListeners don't automatically format messages; you need to implement this code yourself. Check out the code of one of the existing formatter-aware TraceListeners (eg FlatFile or EventLog) to see how this is done.

HTH
Tom
Jan 10, 2007 at 10:53 AM
Thanks for the reply Tom.

I've checked in the code, and managed to get it to work with a little hack.
I hard code the formatting in the trace listener, since it can't seem to pick up the formatter by itself.

Anyhow, thanks a lot for the help.

Martin