Simple Console Listener

Topics: Logging Application Block
Feb 10, 2009 at 7:14 PM
Edited Feb 10, 2009 at 7:14 PM
I need to use a ConsoleListener, but I want to be able to use a text formatter. How can I do that?

My goal is simply to have a simple output to the console - just a timestamp and the message.
Feb 11, 2009 at 5:32 AM
Hi,

As this post discuss http://www.codeplex.com/entlib/Thread/View.aspx?ThreadId=13468 , using a textformatter for a consoletracelistener is not possible. However, you can resort on creating your own custom trace listener, wherein the custom trace listener can be used together with a text formatter.

Creating a custom trace listener : http://msdn.microsoft.com/en-us/library/dd139989.aspx


Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com
Feb 11, 2009 at 3:49 PM
If I create a custome trace listener, will I be able to associate text formatters with it in the configuration tool?
Feb 11, 2009 at 9:31 PM
If you use the CustomTraceListener as the base class of your formatted console listener then you will be able to set the text formatters within the configuration tool. I had to do this same type of things a few days ago. 
Feb 13, 2009 at 9:09 AM
Yes, that is correct. CustomTraceListeners come with a property Formatter so a formatter that is in the "Formatters" node can be associated with it.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com