RE Flat File Trace Listener and Ent Lib Log App block

Topics: Logging Application Block
Jan 15, 2007 at 7:36 PM
Hi, I'm thinking of using the Ent Lib 2.0 logging application block in a project. Does it provide support for"

a) Can it be used with TraceSwitch class? I've used this with the classes directly in the System.Diagnostics namespace, but I'm not sure how it can be combined with Ent Lib 2.0 logging block.

b) Does Ent Lib 2 provide facility to manage creation of log files- like create a new file every day, deleting files older than a certain date?

Jan 15, 2007 at 11:49 PM
Ok, I see for (2), there is an extension that makes use of a RollingFlatfile tracelistener.

I still haven't seen any examples of using the Switch class or how you can manage different levels of logging. I see a CategoryAttribute, bbut it doesn't do anything. Suggestions appreciated. Thanks
Jan 16, 2007 at 3:55 AM
Re a): You can't use TraceSwitches in quite the same way, although Filters give you the ability to filter log messages based on a number of criteria. In addition, each Log Source includes a "source level" property that lets you further filter the message based on the severity.

Re b): As you've seen, there are a number of rolling flat file trace listeners - see for a few options. Also we're planning on including one in EntLib v3 - it should feature in this month's CTP.

Jan 16, 2007 at 5:24 PM
Thanks, Tom. I see that it works, but the setup is different than if you use the System.Diagnostics classes directly. It is actually simplier, this way.