Groups | Blog | Home
all groups > visual studio .net enterprise tools > may 2007 >

visual studio .net enterprise tools : Logging Application Block 2.0- cannot log to database


dmalhotr2001 NO[at]SPAM yahoo.com
5/11/2007 4:16:45 PM
Hi,

I'm trying to log to the database however nothing is getting stored in
the database. The flat file works fine however the database is not
working properly.

Please take a look at my web.config file and let me know.

Thanks in advance

:D


#####################################################################################

<configSections>
<section name="loggingConfiguration"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null" />
<section name="dataConfiguration"
type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings,
Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null" />
</configSections>
<loggingConfiguration name="Logging Application Block"
tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add databaseInstanceName="Connection String"
writeLogStoredProcName="WriteLog"
addCategoryStoredProcName="AddCategory" formatter="Text
Formatter"

listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData,
Microsoft.Practices.EnterpriseLibrary.Logging.Database,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
traceOutputOptions="None"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener,
Microsoft.Practices.EnterpriseLibrary.Logging.Database,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
name="Database Trace Listener" />
</listeners>
<formatters>
<add template="Timestamp: {timestamp}&#xA;Message:
{message}&#xA;Category: {category}&#xA;Priority:
{priority}&#xA;EventId: {eventid}&#xA;Severity: {severity}&#xA;Title:
{title}&#xA;Machine: {machine}&#xA;Application Domain:
{appDomain}&#xA;Process Id: {processId}&#xA;Process Name:
{processName}&#xA;Win32 Thread Id: {win32ThreadId}&#xA;Thread Name:
{threadName}&#xA;Extended Properties: {dictionary({key} -
{value}&#xA;)}"

type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General" />
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors &amp; Warnings">
<listeners>
<add name="Database Trace Listener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
<dataConfiguration>
<providerMappings>
<add
databaseType="Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase,
Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null"
name="System.Data.SqlClient" />
</providerMappings>
</dataConfiguration>
<connectionStrings>
<add name="Connection String" connectionString="Driver={SQL
Server};Server=Davis\Davis;Database=Logging;Trusted_Connection=Yes;"
providerName="System.Data.SqlClient" />
</connectionStrings>

#####################################################################################
Bryan Phillips
5/13/2007 12:36:02 AM
I doubt that this would make a difference, but your connection string is
not valid.

You should use this connection string when using the SqlClient provider:
"Server=Davis\Davis;Database=Logging;Integrated Security=SSPI;"

--
Bryan Phillips
MCT, MCSD, MCDBA, MCSE
Blog: http://bphillips76.spaces.live.com
Web Site: http://www.composablesystems.net



[quoted text, click to view]
AddThis Social Bookmark Button