EntLibConfig doesn't recognize my custom trace listener

Topics: Building and extending application blocks, Logging Application Block
Mar 10, 2011 at 5:16 PM
Edited Mar 10, 2011 at 6:13 PM

I created a new project in VS2010 and implemented a custom trace listener with basic integration according to http://msdn.microsoft.com/en-us/library/ff664483(v=PandP.50).aspx and http://msdn.microsoft.com/en-us/library/ff664603(v=PandP.50).aspx

I added the following references to the project:



And I implemented DebugTraceListener.cs:

using System.Diagnostics; 
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration; 
using Microsoft.Practices.EnterpriseLibrary.Logging; 
using Microsoft.Practices.EnterpriseLibrary.Logging.Configuration; 
using Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners; 

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

   public override void Write(string message) { 

   public override void WriteLine(string message) { 

I build the project as a class library, but then when I try to create a new custom trace listener and open the dll in EntLibConfig no types show up. What could I be missing here?

Mar 10, 2011 at 8:36 PM
Edited Mar 10, 2011 at 8:44 PM

I think I just solved my own problem, but it's a bit of a hack. I went in and manually added the listener to my App.config file in the VS XML editor.

<add listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.CustomTraceListenerData, ..."
   type="DebugTraceListener, CustomProviders" name="Debug Listener"
   formatter="Text File Formatter" />

Now when I run the external configuration tool the my trace listener is there, and I can modify all of the settings just fine. But I am still having the same problem mentioned above. The listener won't show up in the types list when I try to add a new custom trace listener using the external configuration tool, even after clicking "Add from file" and selecting the assembly manually. It's not a huge deal at this point seeing as my logger is working now, but I'd still like to hear some feedback as to why I'm having this problem if anybody has any ideas.

Mar 11, 2011 at 12:19 AM

You just probably need to restart Visual Studio.  This is required when the assembly has been previously loaded in the config tool and the custom provider doesn't exists yet in that assembly at that time.   After an assembly is loaded, it is not reloaded, so changes in the code will not be visible unless you restart Visual Studio.


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.

Mar 11, 2011 at 7:03 PM

Thanks for the suggestion, but that didn't fix the issue. The custom trace listener is in it's own completely separate library. I never loaded the assembly in the config tool before creating this provider. In fact, so far this provider is the only thing in the assembly.

Mar 14, 2011 at 1:52 AM

There are only 2 possible reasons I know of.  The first is there's no ConfigurationElementType attribute in your custom trace listener but in your posted code, I can see that it does have that. The other one is if the custom provider is built with a different version but I don't think this is the reason since you have the custom trace listener working.   Could you send a simple repro?


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.

Mar 14, 2011 at 6:43 PM

Yeah, I could probably make that happen. Do you mean just email it to you? Also, what would you like it to include? I'm thinking:

  • The VS project mentioned above
  • The assembly I built from the project
  • All of the EntLib blocks I'm referencing (I'm not using the GAC)
  • My EntLibConfig.exe
  • My config file (being used by a separate project, which unfortunately I cannot send to you)

Anything else?

Mar 15, 2011 at 1:18 AM

Was your custom provider defined in a project reference or in an assembly referece?  If it's an assembly reference, does the custom trace listener still doesn't show up in a stand-alone EntLib configuration tool or in a Visual Studio integrated tool opened on a different visual studio solution?  If yes, could you send the assembly to me?

If it's a project reference, try creating a new project in a different solution and add the project where the custom trace listener is.  Build the solution and attempt to try if you will be able to load the custom trace listener in the EntLib config tool.  If it still doesn't show up, kindly send the custom trace listener project to me.


Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.

Aug 12, 2011 at 12:29 PM
Edited Aug 12, 2011 at 12:30 PM


Can you tell me what was the final solution for the above problem as I am having the same problem with my Custom trace listener

Aug 15, 2011 at 8:30 AM


Can you try placing the compiled dll of your customer trace listener to the bin folder of Entlib Installation Path (commonly C:\Program Files\Microsoft Enterprise Library 5.0\Bin)?


Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us

Nov 14, 2012 at 2:42 PM

Hi there, I realize I am reviving an old thread but I desperately need help.

I am using Enterprise Library 5.0 for logging and like others I have created my own custom trace listener.... but it is not what you call a CustomTraceListener.  My listener extends FormattedTraceListenerBase with a listener data class which extends FormattedDatabaseTraceListenerData.  The code is exactly the same as the DatabaseTraceListener except it has a different name.  


Now when I add a logging target listener in the configuration tool I would not add my listener through the custom trace listener (like the original poster), instead I would expect it to appear in the list of listeners.  THIS IS THE PROBLEM.


If I put my class in a custom assembly of mine it does not appear in the list of trace listeners.  However, if I put the class in Enterprise Library's code and rebuild it, the trace listener appears in the list.  However, we do not want to alter any of the Enterprise Library code therefore we want to keep it in our own assembly.  


I can find no documentation around this or even anything on the internet.  This post is the closest thing but unfortunately does not address my scenario.  Please help!!!!!


Extra info:  My custom DLL was dropped into the same location as the Enterprise Library config tool's exe location along with all the other DLLs.

Nov 14, 2012 at 2:52 PM

To further supplement my case...  I downloaded the example from 




which said all I had to do was "simply" drop the DLL into bin folder of my Enterprise Library Configuration tool...  I did so and they did not show up either!

Nov 14, 2012 at 3:01 PM

Solved it!!!  As well my DLL, I need to drop in all my DLL's dependencies :) - pretty sure thats the solution for the original poster too as I had 2 custom trace listeners - one which extended CustomTraceListener so I both issues.  


In summary, ensure you drop in all DLLs that the DLL with the trace listeners reference.