Direct Attributes Init for CustomTraceListener

Topics: Logging Application Block
Jun 8, 2012 at 6:43 AM
Edited Jun 8, 2012 at 6:44 AM

I want to initialize my tracelistener's member-fields without using Attributes["blahblah"]; like RollingFlatFileTraceListener or others; not like this ( ).

        private string connectionStringName = null;
        private string DatabaseInstanceName
                if (string.IsNullOrEmpty(connectionStringName))
                    connectionStringName = this.Attributes["DatabaseInstance"];
                return connectionStringName;

I know CustomTraceListener class or its descendants' Constructor() cannot access to attributes by Attributes[]. 

So I tried to extend CustomTraceListenerData, but EntLib V5 Config Tool does not recognize my tracelistener class when I used my tracelistenerdata class.

Is there any way possible?

Jun 8, 2012 at 8:16 AM

You want "Full Integration" with Enterprise Library.  See Adding Full Design-time Integration for the steps.

You can also take a look at the Rolling XML Trace Listener on the Samples Page for a working implementation of Full Design-time Integration.

Randy Levy
Enterprise Library support engineer