Try replacing System.Diagnostics.TraceListener in the type attribute with
your namespace.


--
-Christopher
ASP.NET MVP | AspInsider
http://chrisfrazier.net/blog

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Ben Joyce
Sent: Wednesday, August 23, 2006 10:31 AM
To: [email protected]
Subject: [ADVANCED-DOTNET] Creating a custom TraceListener...

Hi all.

I'm trying to write a TraceListener to log Debug.Write output into a
database.

I've made a simple class as follows:

----- 8<-----
Public Class CustomListener

Inherits System.Diagnostics.TraceListener

Public Overloads Overrides Sub Write(ByVal Message As String)

'yadda

End Sub

Public Overloads Overrides Sub WriteLine(ByVal Message As String)

'yadda

End Sub

End Class
----- >8 -----

And I have added the following to my web.config file:

----- 8< -----
        <system.diagnostics>
                <trace autoflush="true" indentsize="0">
                        <listeners>
                                <add name="MyCustomListener"
type="System.Diagnostics.TraceListener,CustomListener" />
                        </listeners>
                </trace>
        </system.diagnostics>
----- >8 -----

However, I'm getting an error when I try to do a Debug.Write:

----- 8< -----
An exception of type
'System.Configuration.ConfigurationErrorsException' occurred in System.dll
but was not handled in user code

Additional information: Couldn't find type for class
System.Diagnostics.TraceListener,CustomListener.
----- >8 -----

Anyone got any ideas?  Bit stumped here.

Cheers,

Ben

===================================
This list is hosted by DevelopMentorR  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to