Enterprise Library

Topics: Enterprise Library Core
Jul 3, 2014 at 10:03 AM
I am using enterprise library, I creates custom listener and custom tracelistnerdata .
I am getting following error in my code:
System.NotImplementionException-:{"Must be implemented by subclasses."}

at the line:
Logger.SetLogWriter(logWriterFactory.Create());

When I searched that error I got a solution :
I'm assuming you are using XML configuration. What does the configuration look like? I'm going to guess that thelistenerDataType is set toMicrosoft.Practices.EnterpriseLibrary.Logging.Configuration.TraceListenerData or that you have created a custom TraceListenerData. In either case, the method CoreBuildTraceListener needs to be overridden.

So, the listenerDataType should not be set to TraceListenerData and when creating a custom TraceListenerData class the CoreBuildTraceListener needs to be given an implementation

but I already implemented the CoreBuildTraceListener method as below:
protected override TraceListener CoreBuildTraceListener(LoggingSettings settings)
   {
       Database database = new DatabaseProviderFactory().Create(this.DatabaseInstanceName);
       var formatter = this.BuildFormatterSafe(settings, this.Formatter);
       return new CustomDatabaseTraceListener(database, writeLogStoredProcNameProperty, addCategoryStoredProcNameProperty, formatter);
   }

Please provide me help of that error.
Jul 6, 2014 at 6:31 PM
It's difficult to say what is happening from the code snippet. Can you post a complete example that replicates the issue (TraceListener, TraceListenerData, XML configuration, etc.)?

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to