views:

46

answers:

1

Hello,

What I am doing: I am taking the Microsoft Enterprise Library 4.1 and attempting to expand upon it using a few derived classes.

I have created a MyLogEntry, MyFormatter, and MyTraceListener which derive from their respective base classes when you remove the "My" from their names.

What my problem is: Everything compiles fine. When I go to run a test using Logger.Write(logEntry) it errors right after it initializes MyTraceListener with an error message:

"The current build operation (... EnterpriseLibrary.Logging.LogWriter, null]) failed: Constructor on type 'MyLogging.MyFormatter' not found. (Strategy type ConfiguredObjectStrategy, index 2)

I figured it was something to do with the constructor so I tried removing it, add it, and adding a call to the base class LogFormatter. Nothing has worked.

Does anyone have insight into this problem? Is it maybe a reference issue? Bad App.config configuration?

Thank you in advance

A: 

My guess is you did not provide the right constructor. In order to inject your custom formatter you need to provide a constructor similar to the below

public MyFormatter(NameValueCollection collection){

 }

For more information see this link

Nix
Thank you Nix that was the problem exactly.
WaffleTop