System.Diagnostics TraceListener and Format

Topics: Logging Application Block, Pre-release discussions
Jul 9, 2008 at 1:15 PM
I want to write a message to Console,Trace etc. And i use EL's System.Diagnostics TraceListener.
But problem for me that this listener not support formatters, and then is write
Logger.Write(LogEntry) i recive all info from logEntry, but i need to print only message.
How can i do this?
Jul 9, 2008 at 3:04 PM
Hi,

Those trace listeners rely on the return value of the ToString() method on traced object, which happens to include all the properties for a LogEntry. You'll need to either change the trace listeners (by extending them to override the implementation of the TraceData method) or the implementation for ToString() for a LogEntry (by changing it, if you want to update the source code, or by extending it if you want to keep the signed binaries). Neither alternative is very attractive IMO...

Fernando


pmatveev wrote:
I want to write a message to Console,Trace etc. And i use EL's System.Diagnostics TraceListener.
But problem for me that this listener not support formatters, and then is write
Logger.Write(LogEntry) i recive all info from logEntry, but i need to print only message.
How can i do this?