Ben Joyce <[EMAIL PROTECTED]> wrote:

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

I've never had the need to write a trace listener, but I can tell you
the reason for your error.

> Public Class CustomListener

This class is compiled into an assembly.

>                         <listeners>
>                                 <add name="MyCustomListener"
> type="System.Diagnostics.TraceListener,CustomListener" />

You need to reference your class in this line. The format is described
by Type.AssemblyQualifiedName in MSDN. The most important bits are the
assembly and type - here you've said that CustomListener is located in
an assembly called System.Diagnostics.TraceListener. That's why you get
the exception you do.

You should probably have something more like:

  type="My.Namespace.Here.CustomListener"

if the type is declared in the executable, or something like:

  type="MyAssembly,My.Namespace.Etc.CustomListener"

if the type is declared in MyAssembly.dll, etc. You may need to add
extra qualifications as needed to the type. You can find the full type
name by writing typeof(CustomListener).AssemblyQualifiedName to the
console, or whatever the VB equivalent is.

-- Barry

-- 
http://barrkel.blogspot.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