Error in TraceListenerData

Topics: Logging Application Block
Jan 8, 2008 at 2:35 PM
Edited Feb 5, 2008 at 11:09 AM
Hello

I have been trying to configure a databse listener, pointing to a local SQL Express Database, but I keep getting the following error.

Invalid TraceListenerData type in configuration 'listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"'. (C:\\..UserInterface.Smartclient\bin\Debug\..UserInterface.Smartclient.vshost.exe.config line 11)

I tried using the default Logging database (created by the the create DB command from the Ent-Lib start menu), and also with the Logging tables and stored procs created in another Database.

I have a flat file trace listener that works fine, when I remove the Db trace listener, but doesn't work with it.

my App.Config
<configuration>
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>
<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add databaseInstanceName="Logging" writeLogStoredProcName="WriteLog"
addCategoryStoredProcName="AddCategory" formatter="Text Formatter"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Database Trace Listener" />
<add source="Enterprise Library Logging" formatter="Text Formatter"
log="Application" machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
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=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="DBEvents">
<listeners>
<add name="Database Trace Listener" />
</listeners>
</add>
<add switchValue="All" name="General">
<listeners>
<add name="Formatted EventLog TraceListener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category">
<listeners>
<add name="Formatted EventLog TraceListener" />
</listeners>
</notProcessed>
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Database Trace Listener" />
<add name="Formatted EventLog TraceListener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
<connectionStrings>
<add name="DTM02" connectionString="Data Source=192.168.2.222;Initial Catalog=O;Persist Security Info=True;User ID=SCUser;Password=********"
providerName="System.Data.SqlClient" />
<add name="Logging" connectionString="Data Source=(local)\SQLEXPRESS;Initial Catalog=Logging;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>

I've got reference to
Microsoft.Practices.EnterpriseLibrary.Logging.Database;
Microsoft.Practices.EnterpriseLibrary.Logging;
Microsoft.Practices.EnterpriseLibrary.Common;
Microsoft.Practices.ObjectBuilder;
Jan 8, 2008 at 3:09 PM
Hi,

You need to deploy the assembly Microsoft.Practices.EnterpriseLibrary.Database with your application, as it's required by Microsoft.Practices.EnterpriseLibrary.Logging.Database. You could add a reference to it for the build process to copy it for you, or copy it yourself (and the same goes for Microsoft.Practices.EnterpriseLibrary.Logging.Database).

Fernando
Jan 8, 2008 at 3:23 PM

fsimonazzi wrote:
Hi,

You need to deploy the assembly Microsoft.Practices.EnterpriseLibrary.Database with your application, as it's required by Microsoft.Practices.EnterpriseLibrary.Logging.Database. You could add a reference to it for the build process to copy it for you, or copy it yourself (and the same goes for Microsoft.Practices.EnterpriseLibrary.Logging.Database).

Fernando


There is no Microsoft.Practices.EnterpriseLibrary.Database, I added Microsoft.Practices.EnterpriseLibrary.Data but that doesn't work eather.
Jan 10, 2008 at 7:19 PM
I've got the solution,
You must add the reference to the start up project, where my app.config is located. Not only in the project where I use the entlib