Unable to get FormattedDatabaseTraceListener to work properly

May 20, 2007 at 7:02 PM
Hi

I am trying to log a simple exception to the database(Entib 3.0 - Excepiton block + Logging block + DA Block). The exception is getting logged in the Message and FormattedMessage columns of the Log table of the Loggibg database.
However, only a small portion of the exception is being written When I log to the rolling trace listener, I get everything(Source, StackTrace, Message, AdditionalProperties etc)

This is what I see in the Logging database for the Message and FormattedMessage columns

Message
HandlingInstanceID: b1fdbb41-4960-4c4d-bde0-2a3023d76ba4
<Exception>
<Description>An exception of type 'System.Exception' occurred and was caught.</Description>
<DateTime>2007-05-20 14:56:08Z</DateTime>
<ExceptionType>System.Exception, mscorlib, Message: HandlingInstanceID: b1fdbb41-4960-4c4d-bde0-2a3023d76ba4

FomattedMessage
<Exception>
<Description>An exception of type 'System.Exception' occurred and was caught.</Description>
<DateTime>2007-05-20 14:56:08Z</DateTime>
<ExceptionType>System.Exception, m

That is all that is being written to the database



This is what my Config file looks like


<configuration>
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<section name="customExceptionConfiguration" type="CompanyName.ProjectName.Common.Global.ExceptionManagement.EntLibExceptionHandler, CompanyName.ProjectName.Common.Global, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<section name="customLoggingConfiguration" type="CompanyName.ProjectName.Common.Global.Logging.EntLibLogHandler, CompanyName.ProjectName.Common.Global, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<section name="customCachingConfiguration" type="CompanyName.ProjectName.Common.Global.CacheManagement.EntLibCacheHandler, CompanyName.ProjectName.Common.Global, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</configSections>
<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add databaseInstanceName="LoggingServer" writeLogStoredProcName="WriteLog"
addCategoryStoredProcName="AddCategory" formatter="Text Formatter"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=3.0.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.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Formatted EventLog TraceListener" />
<add fileName="rolling.log" rollSizeKB="0" timeStampPattern="yyyy-MM-dd"
rollFileExistsBehavior="Increment" rollInterval="Day" formatter="Text Formatter"
header="----------------------------------------" footer="----------------------------------------"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Rolling Flat File Trace Listener" />
</listeners>
<formatters>
<add template="Message: {message}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="Database Trace Listener" />
<add name="Rolling Flat File Trace Listener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings" />
</specialSources>
</loggingConfiguration>
<exceptionHandling>
<exceptionPolicies>
<add name="GLOBAL_POLICY">
<exceptionTypes>
<add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
postHandlingAction="NotifyRethrow" name="Exception">
<exceptionHandlers>
<add logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling"
formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.XmlExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
name="Logging Handler" />
</exceptionHandlers>
</add>
</exceptionTypes>
</add>
</exceptionPolicies>
</exceptionHandling>
<dataConfiguration defaultDatabase="LoggingServer" />
<connectionStrings>
<add name="LoggingServer" connectionString="Database=Logging;Server=NYC1-RVENUGOPAL\SQLEXPRESS;Integrated Security=SSPI"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>


Thanks
-RV

PS :- I am able to log lhe same exception in full using the RollingFlatFileTraceListener although the starting pattern in the config file is not coming into effect. If you could advise on this as well, that would be great.
May 25, 2007 at 11:38 PM
This forum is for CodePlex web site issues and discussion only. Please re-post your question to the appropriate project's forum.

Thanks!
Apr 2, 2008 at 5:09 AM
Testing by sownya