custom database trace listener enterprise library

Topics: Building and extending application blocks, Logging Application Block
Apr 7, 2010 at 1:57 PM

Using Microsoft Logging Application block, I want to log errors in one of my tables in my database (instead of default table "log" which gets created for Microsoft Application Block looging purpose). For that, we need to customize the database trace listener. Can anyone please let me know the detail steps to do that. Thanks in advance.

Apr 8, 2010 at 1:07 AM

Here's an FAQ item that discusses that http://entlib.codeplex.com/wikipage?title=How%20can%20I%20log%20to%20a%20custom%20database%2ftable%3f&referringTitle=EntLib%20FAQ.

Also, you can check this thread for some other information and references http://entlib.codeplex.com/Thread/View.aspx?ThreadId=83105.

Hope this helps.

~ginkapitan

Apr 8, 2010 at 6:08 AM
Thanks..I am still having some difficulties. It would be great if you can post a sample code to log into a different table.
Apr 8, 2010 at 7:25 AM

Below is a sample of a CustomDBTraceListener I've created. Take note that the Attributes["Database"] and Attributes["WriteStoredProc"] values are defined

in the Attributes Property of my CustomDBTraceListener in the config. The Database and Stored Procedure itself will depend on your needs and what

you'll going to use.

 

Anyway, if you have any other questions or concerns just let me know.

 

HTH

~ginkapitan

Sample Custom Database Trace Listener:
 [ConfigurationElementType(typeof(CustomTraceListenerData))]
    public class CustomDBTraceListener : CustomTraceListener
    {

        public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data)
        {
            if (data is LogEntry && data != null)
            {
                Database db = DatabaseFactory.CreateDatabase(this.Attributes["Database"]);
                
                DbCommand cmd = db.GetStoredProcCommand(this.Attributes["WriteStoredProc"]);
                

                LogEntry le = (LogEntry)data;                
                db.AddParameter(cmd, "severity", DbType.String, 32, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, le.Severity.ToString());
                db.AddInParameter(cmd, "timestamp", DbType.DateTime, le.TimeStamp);
                db.AddParameter(cmd, "message", DbType.String, 1500, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Default, le.Message);                
                db.AddInParameter(cmd, "ExtendedProperty", DbType.String, System.Security.Principal.WindowsIdentity.GetCurrent().Name);
                db.AddOutParameter(cmd, "LogId", DbType.Int32, 4);
                db.ExecuteNonQuery(cmd);
            }
        }

        public override void Write(string message)
        {
            throw new NotImplementedException();
        }

        public override void WriteLine(string message)
        {
            throw new NotImplementedException();
        }
    }

Apr 8, 2010 at 4:56 PM

Thanks a lot for the help. If you dont mind, please send me the sample of the config file also. Just wanted to confirm the followings:

1. There will be no implementation in Write and WriteLine methods in CustomDBTraceListener class.

2.  Do I need to create a class TraceEventCache to override it? If yes, please send me the sample for this also.

3. Do I need to do anything to override TraceEventType also?

4. Please send the config sample also.

Thanks a lot again.

Apr 9, 2010 at 4:43 AM

Hi,

To answer your questions please see below responses.

1. There will be no implementation in Write and WriteLine methods in CustomDBTraceListener class.

      - No it's not like that it just happen that I opt not to utilize it, this is all up to you but you can use this reference http://customdatabasetracelistener.blogspot.com/2009/06/custom-dbtracelistener-w-custom.html to see the pupose of this method. 

2.  Do I need to create a class TraceEventCache to override it? If yes, please send me the sample for this also.

      - No, you do not need to. This is a default argument parameter for your TraceData method which this method is the one you'll need to override in your Custom TraceListener.

3. Do I need to do anything to override TraceEventType also?

       - I'm not sure what specifically do you mean about this question. TraceEventType is an Enum and you do not need to do anything about this.

4. Please send the config sample also.

       - I can send a sample project if you want to, just let me know to where to send it.

HTH,

~ginkapitan

 

 

Apr 9, 2010 at 5:28 AM

Thank You Very Much. Please send it to basabdatta.nayak@capgemini.com.

Apr 9, 2010 at 7:38 AM

I have few more doubts. I created the following class. In TraceData method, I am not supposed to pass "new LogEntry()", instead I should pass the LogEntry object which is used to enter user data.

But dont know how to do that.
 
[ConfigurationElementType(typeof(CustomTraceListenerData))]
public class CustomDBTraceListener : CustomTraceListener
{

    public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data)
    {
        if (data is LogEntry && data != null)
        {
            LogEntry le = (LogEntry)data;

            string con = "Data Source=PXSNYXMSSQL001V;Initial Catalog=Sandbox;User Id=User;Password=Pas";
            SqlConnection conn = new SqlConnection(con);
            SqlCommand cmd = new SqlCommand("WriteLog1", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@TraceID", SqlDbType.UniqueIdentifier)).Value = new Guid();
            cmd.Parameters.Add(new SqlParameter("@Message", SqlDbType.NVarChar)).Value = le.Message;
            cmd.Parameters.Add(new SqlParameter("@Source", SqlDbType.NVarChar)).Value = source;
            cmd.Parameters.Add(new SqlParameter("@MachineName", SqlDbType.NVarChar)).Value = le.MachineName;
            cmd.Parameters.Add(new SqlParameter("@Severity", SqlDbType.NVarChar)).Value = le.Severity;
            cmd.Parameters.Add(new SqlParameter("@Created", SqlDbType.DateTime)).Value = le.Timestamp;
            SqlParameter LogIDinfo = new SqlParameter("@LogID", SqlDbType.Int);
            LogIDinfo.Direction = ParameterDirection.Output;
            cmd.Parameters.Add(LogIDinfo);
            conn.Open();
            cmd.ExecuteNonQuery();
            conn.Close();
        }
    }

    public override void Write(string message)
    {
        TraceData(new TraceEventCache(), message, new TraceEventType(), 7, new LogEntry());  //Passing this LogEntry object is of no use here as it's not user provided one.
    }

    public override void WriteLine(string message)
    {
        TraceData(new TraceEventCache(), message, new TraceEventType(), 7, new LogEntry());
    }
}


Then from the application, I am supposed to use LogEntry class and write LogEntry properties through Logger.Write() method.

If I do that, it am not executing CustomDBTraceListener  class. However, if I use CustomDBTraceListener class then I can send only the "message", I can not send all the properties of LogEntry.
Please let me know the solution.

Please refer the below code:

(I can not use this as it wont execute CustomDBTraceListener class)
LogEntry le = new LogEntry();
le.Message = "Log message test - BN1";
le.Severity = 4;
Logger.Write(le);

(If I use the below code, I can't pass LogEntry object)
CustomDBTraceListener trace = new CustomDBTraceListener();
trace.Write("Log message test - BN1");

Please let me know the solution ASAP. Thanks again.

Apr 9, 2010 at 7:45 AM

I just created one more method in CustomDBTraceListener class:

 public void Logger(LogEntry le)
    {
        TraceData(new TraceEventCache(), le.Message, new TraceEventType(), 7, le);
    }

Then I am calling this method from the application to pass the LogEntry object. Couldn't check because of DB problem. Please let me know your opinion on this.

 

Apr 12, 2010 at 1:42 AM

You should be overriding the TraceData method, not creating a new version of it.  And you are to call the Logger.Write API and not be newing up your custom trace listener.

There are also other Write methods you could overwrite in your custom trace listener.  One of it is the Write(object) method.  Usually, I override the Write(string) and Write(object) methods.  These are where I put my logic for actually writing the log to the database.  Then in the TraceData method, I determine if the data parameter is simply of type string or a LogEntry object.  If it's a string, I pass it to the Write(string) method, if it's a LogEntry object, I pass it to the Write(object) method.  Of course, there are a lot of ways you can do this, this is just a sample, not a standard.  The implementation would totally depend on how you do things in your app, what is your expected input, etc..

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 12, 2010 at 5:11 AM

Hi,

I have sent out a mailt o your gmail a/c with error details...please help.

Apr 12, 2010 at 5:52 AM

Feel free to also send it to entlib.support@avanade.com 

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 12, 2010 at 6:38 AM

Again thanks for all your support. BTW, please let me know if the following is right.

 ExtendedLogEntry le = new ExtendedLogEntry();

le.Message = "Log message test - BN4";

ExtendedCustomTraceListener a = new ExtendedCustomTraceListener();

a.Write(le);

Apr 12, 2010 at 7:17 AM

Nope, you should not be instantiating any trace listener.  The Logger.Write API should take care of it and you should have associated your custom trace listener to a category.

In your email, I think the error has something to do with your config file and the version of entlib assemblies you are using.  Can you send your config file as well and tell me what version of entlib are you using?

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 12, 2010 at 7:27 AM

FYI: I am using EntLib version 4.1.

Config file:

<?xml version="1.0" encoding="utf-8"?>

<configuration>

  <configSections>

    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

  </configSections>

  <loggingConfiguration name="Logging Application Block" tracingEnabled="true"

    defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">

    <listeners>

      <add listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.CustomTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

        traceOutputOptions="None" filter="All" type="LoggingLibrary.ExtendedDatabaseTraceListener, LoggingLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"

        name="Custom Trace Listener" initializeData="" formatter="Text Formatter" />

      <add source="Enterprise Library Logging" formatter="Text Formatter"

        log="Application" machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

        traceOutputOptions="None" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

        name="Formatted EventLog TraceListener" />

    </listeners>

    <formatters>

      <add template="Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}"

        type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

        name="Text Formatter" />

    </formatters>

    <categorySources>

      <add switchValue="All" name="General">

        <listeners>

          <add name="Custom Trace Listener" />

        </listeners>

      </add>

    </categorySources>

    <specialSources>

      <allEvents switchValue="All" name="All Events" />

      <notProcessed switchValue="All" name="Unprocessed Category" />

      <errors switchValue="All" name="Logging Errors &amp; Warnings">

        <listeners>

          <add name="Formatted EventLog TraceListener" />

        </listeners>

      </errors>

    </specialSources>

  </loggingConfiguration>

  <connectionStrings>

    <add name="Connection String" connectionString="server=abc;database=abc;uid=abc;pwd=abc;"

      providerName="System.Data.SqlClient" />

  </connectionStrings>

</configuration>

 ExtendedLogEntry.cs

namespace LoggingLibrary

{

    class ExtendedLogEntry : LogEntry

    {

        public Guid TraceID { get; set; }

        public Guid ContextID { get; set; }

        public Guid ParentID { get; set; }

        public int Elapsed { get; set; }

        public string Message { get; set; }

        public string Source { get; set; }

        public string StackTrace { get; set; }

        public string MachineName { get; set; }

        public DateTime Created { get; set; }

    }

}

ExtendedDatabaseTraceListener.cs

namespace LoggingLibrary

{

    [ConfigurationElementType(typeof(CustomTraceListenerData))]

    public class ExtendedDatabaseTraceListener : CustomTraceListener

    {

     public ExtendedDatabaseTraceListener()        {        }

     public override void TraceData(System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, object data)

        {

            if (data is ExtendedLogEntry)

            {

                ExtendedLogEntry entry = data as ExtendedLogEntry;

                if (entry != null)

                {

                    string con = "Data Source=ds;Initial Catalog=ic;User=ui;Password=pass";

                    SqlConnection conn = new SqlConnection(con);

                    SqlCommand cmd = new SqlCommand("WriteLog1", conn);

                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.Add(new SqlParameter("@TraceID", SqlDbType.UniqueIdentifier)).Value = Guid.NewGuid(); // TraceContext.ID;

                    cmd.Parameters.Add(new SqlParameter("@ContextID", SqlDbType.UniqueIdentifier)).Value = Guid.NewGuid();

                    cmd.Parameters.Add(new SqlParameter("@ParentID", SqlDbType.UniqueIdentifier)).Value = Guid.NewGuid();

                    cmd.Parameters.Add(new SqlParameter("@Elapsed", SqlDbType.Int)).Value = 0;//id;

                    cmd.Parameters.Add(new SqlParameter("@Message", SqlDbType.NVarChar)).Value = entry.Message;

                    cmd.Parameters.Add(new SqlParameter("@Source", SqlDbType.NVarChar)).Value = source;

                    cmd.Parameters.Add(new SqlParameter("@MachineName", SqlDbType.NVarChar)).Value = entry.MachineName;

                    cmd.Parameters.Add(new SqlParameter("@StackTrace", SqlDbType.NVarChar)).Value = "";

                    cmd.Parameters.Add(new SqlParameter("@Created", SqlDbType.DateTime)).Value = DateTime.Now;

                    SqlParameter LogIDinfo = new SqlParameter("@LogID", SqlDbType.Int);

                    LogIDinfo.Direction = ParameterDirection.Output;

                    cmd.Parameters.Add(LogIDinfo);

                    conn.Open();

                    cmd.ExecuteNonQuery();

                    conn.Close();

                }

            }

        }

         public override void Write(string message)

        {

            throw new NotImplementedException();

        }

 

        public override void WriteLine(string message)

        {

            throw new NotImplementedException();

        }

    }

 }

Then I am calling it like this:

ExtendedLogEntry entry = new ExtendedLogEntry();

entry.Message = "BN123";

Logger.Write(entry);

 

Apr 12, 2010 at 7:47 AM

I created another sample project. Here it's not throwing any error. But it's not even writing to the database. (I have put a break point in TraceData method. But it's not even hitting that breakpoint)

Config file for this sample project is as follows:

<?xml version="1.0" encoding="utf-8"?>

<configuration>

  <configSections>

    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

  </configSections>

  <loggingConfiguration name="Logging Application Block" tracingEnabled="true"

    defaultCategory="" logWarningsWhenNoCategoriesMatch="false">

    <listeners>

      <add databaseInstanceName="Connection String" writeLogStoredProcName="WriteLog1"

        addCategoryStoredProcName="AddCategory" formatter="Text Formatter"

        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

        traceOutputOptions="None" filter="Error" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

        name="Database Trace Listener" />

    </listeners>

    <formatters>

      <add template="Timestamp: {timestamp} Message: {message} Category: {category} Priority:  {priority} EventId: {eventid} Severity:  {severity} Title:{title} Machine:  {machine} Application Domain:  {appDomain} Process Id: {processId} Process Name: {processName} Win32 Thread Id: {win32ThreadId} Thread Name:  {threadName} Extended Properties: {dictionary({key}  - {value} )}"

        type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

        name="Text Formatter" />

    </formatters>

    <categorySources>

      <add switchValue="All" name="General">

        <listeners>

          <add name="Database Trace Listener" />

        </listeners>

      </add>

    </categorySources>

    <specialSources>

      <allEvents switchValue="All" name="All Events">

        <listeners>

          <add name="Database Trace Listener" />

        </listeners>

      </allEvents>

      <notProcessed switchValue="All" name="Unprocessed Category" />

      <errors switchValue="Error" name="Logging Errors And Warnings">

        <listeners>

          <add name="Database Trace Listener" />

        </listeners>

      </errors>

    </specialSources>

  </loggingConfiguration>

  <connectionStrings>

    <add name="Connection String" connectionString="server=a;database=b;uid=c;pwd=d;"

      providerName="System.Data.SqlClient" />

  </connectionStrings>

</configuration>

Apr 12, 2010 at 7:49 AM

I've already encountered several issues the same as the error you are encountering.  All of them were caused by using different versions of entlib, or using/referencing the unsigned and signed dlls.  Please check your references.  Make sure you are using the signed ones, the ones that are from the installation folder (Program Files\Microsoft Enterprise Library 4.1 - October 2008\Bin).  If you can't find the culprit, remove and re-add the references.

One more thing, specify the category to which you're custom trace listener is associated to, in this case, it's the General category.

entry.Categories.Add("General");

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 12, 2010 at 9:56 AM

Thanks for the response. I created a new solution and then created a ClassLibrary named LoggingLibrary. Then created a console application and following is the code for that:

 using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

 using LoggingLibrary; //This reference the DLL.

 using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;

using Microsoft.Practices.EnterpriseLibrary.Logging;

using Microsoft.Practices.EnterpriseLibrary.Logging.Configuration;

using Microsoft.Practices.EnterpriseLibrary.Logging.Formatters;

using Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners;

using Microsoft.Practices.EnterpriseLibrary.Data;

namespace LogApp

{

    class Program

    {

        static void Main(string[] args)

        {

            ExtendedLogEntry le = new ExtendedLogEntry();

            le.Message = "Log message test - BN4";

            le.Categories.Add("General");

            Logger.Write(le);

        }

    }

}

 

It throws the following error in Logger.Write(le):

 

Microsoft.Practices.ObjectBuilder2.BuildFailedException was unhandled

  Message="The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter, null]) failed: The type 'LoggingLibrary.ExtendedDatabaseTraceListener, LoggingLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' cannot be resolved. Please verify the spelling is correct or that the full type name is provided. (Strategy type ConfiguredObjectStrategy, index 2)"

  Source="Microsoft.Practices.ObjectBuilder2"

  BuildKey="Build Key[Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter, null]"

  ExecutingStrategyIndex=2

  ExecutingStrategyTypeName="ConfiguredObjectStrategy"

  StackTrace:

       at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)

       at Microsoft.Practices.ObjectBuilder2.Builder.BuildUp(IReadWriteLocator locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain strategies, Object buildKey, Object existing)

       at Microsoft.Practices.ObjectBuilder2.Builder.BuildUp[TTypeToBuild](IReadWriteLocator locator, ILifetimeContainer lifetime, IPolicyList policies, IStrategyChain strategies, Object buildKey, Object existing)

       at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IReadWriteLocator locator, ILifetimeContainer lifetimeContainer, IConfigurationSource configurationSource)

       at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IConfigurationSource configurationSource)

       at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.get_Writer()

       at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(LogEntry log)

       at LogApp.Program.Main(String[] args) in D:\Sony\MyCode\SampleProjects\LoggingLibrary\LogApp\Program.cs:line 24

       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)

       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading.ThreadHelper.ThreadStart()

  InnerException: System.ArgumentException

       Message="The type 'LoggingLibrary.ExtendedDatabaseTraceListener, LoggingLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' cannot be resolved. Please verify the spelling is correct or that the full type name is provided."

       Source="Microsoft.Practices.EnterpriseLibrary.Common"

       StackTrace:

            at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.AssemblyQualifiedTypeNameConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)

            at System.ComponentModel.TypeConverter.ConvertFrom(Object value)

            at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.NameTypeConfigurationElement.get_Type()

            at Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.SystemDiagnosticsTraceListenerAssembler.Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)

            at Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.CustomTraceListenerAssembler.Assemble(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)

            at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.AssemblerBasedObjectFactory`2.Create(IBuilderContext context, TConfiguration objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)

            at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.TraceListenerCustomFactory.Create(IBuilderContext context, TraceListenerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)

            at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.AssemblerBasedCustomFactory`2.Create(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)

            at Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.TraceListenerCustomFactory.Create(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache, TraceListenerCache traceListenersCache)

            at Microsoft.Practices.EnterpriseLibrary.Logging.LogSourceCustomFactory.Create(IBuilderContext context, TraceSourceData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache, TraceListenerCache traceListenersCache)

            at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolderCustomFactory.CreateObject(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)

            at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterCustomFactory.CreateObject(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)

            at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy.PreBuildUp(IBuilderContext context)

            at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)

       InnerException:

Apr 12, 2010 at 10:01 AM

Sorry...I had given the extended trace listner class name wrongly...I just rectified that and it started working fine...Many many thanks for all your help.