Logging to a Sql database fails with Enterprise Library 5.0

Topics: Logging Application Block
Apr 28, 2010 at 1:40 AM

The application compiles cleanly. I add the database listener using the configuration utility. The following exception is thrown.

System.Configuration.ConfigurationErrorsException was unhandled by user code
  Message=Invalid TraceListenerData type in configuration 'listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null"'.
  Source=Microsoft.Practices.EnterpriseLibrary.Logging
  BareMessage=Invalid TraceListenerData type in configuration 'listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=5.0.414.0, Culture=neutral, PublicKeyToken=null"'.
  Line=0
  StackTrace:
       at Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.TraceListenerDataCollection.RetrieveConfigurationElementType(XmlReader reader) in E:\EntLib50Src\Blocks\Logging\Src\Logging\Configuration\TraceListenerDataCollection.cs:line 58
       at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.PolymorphicConfigurationElementCollection`1.OnDeserializeUnrecognizedElement(String elementName, XmlReader reader) in E:\EntLib50Src\Blocks\Common\Src\Configuration\PolymorphicConfigurationElementCollection.cs:line 54
       at System.Configuration.ConfigurationElement.DeserializeElement(XmlReader reader, Boolean serializeCollectionKey)
  InnerException:

Has anyone else gotten logging to a Sql database working with V5.0. Logging to files, console, and Windows event log works.

Doug

Apr 28, 2010 at 1:54 AM

Did you add the Logging.Database assembly to your host project?

 

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

Apr 28, 2010 at 8:22 PM

That fixed the problem. Thank you.