CustomTraceListener on EntLib 5.0

Topics: Logging Application Block
Mar 22, 2010 at 3:22 PM

Hello,

I am trying to add a Custom Trace Listener for the Logging Application Block, but it isn't being recognized on the Available Assemblies of the Enterprise Library Configuratio.

Any clue on what I am doing wrong?

 

Thanks

Mar 22, 2010 at 6:31 PM

Hi,

Are you using the beta 1 release? I tried it in beta2 and its working fine.

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

Mar 23, 2010 at 8:30 AM

I am using the Beta 2 release.

I am just trying to use this Custom Trace Listener that is showed in the documentation:

[ConfigurationElementType(typeof(CustomTraceListenerData))]
    class DebugTraceListener : CustomTraceListener
    {
        public override void TraceData(System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, object data)
        {
            if (data is LogEntry && this.Formatter != null)
            {
                this.WriteLine(this.Formatter.Format(data as LogEntry));
            }
            else
            {
                this.WriteLine(data.ToString());
            }
        }

        public override void Write(string message)
        {
            Debug.Write(message);
        }

        public override void WriteLine(string message)
        {
            Debug.WriteLine(message);
        }
    }

I am also using a Custom Exception Handler in the same application and it works fine...

 

 

Mar 23, 2010 at 9:34 AM

Hi,

Try marking your class as public.

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

Mar 23, 2010 at 9:39 AM

Now it worked!

 

Thank u very much