Note that there are some explanatory texts on larger screens.

plurals
  1. PODatabase Trace Listener with Enterprise library 2.0 not logging in database
    primarykey
    data
    text
    <p>I am using Database TraceListener for logging. I've executed the CreateLoggingDb.cmd and the Logging Database is in place. My web.config looks like the below. </p> <p>When an excpetion occurs I try to log it as below.</p> <pre><code>ExceptionPolicy.HandleException(ex, "PayrollException"); </code></pre> <p>The code runs but it does not log in the database table. Please let me know if the settings in web.config are not correct or the procedure for logging has to be different.</p> <pre><code>&lt;configuration&gt; &lt;configSections&gt; &lt;section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/&gt; &lt;section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/&gt; &lt;section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/&gt; &lt;/configSections&gt; &lt;loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General" logWarningsWhenNoCategoriesMatch="true"&gt; &lt;listeners&gt; &lt;add databaseInstanceName="LoggingConn" 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" /&gt; &lt;/listeners&gt; &lt;formatters&gt; &lt;add template="Timestamp: {timestamp} Message: {message} Category: {category} Priority: {priority} EventId: {eventid} Severity: {severity} Title:{title} Machine: {machine} Application Domain: {appDomain} Process Id: {processId} Process Name: {processName} Win32 Thread Id: {win32ThreadId} Thread Name: {threadName} Extended Properties: {dictionary({key} - {value} )}" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="Text Formatter"/&gt; &lt;/formatters&gt; &lt;categorySources&gt; &lt;add switchValue="All" name="General"&gt; &lt;listeners&gt; &lt;add name="Database TraceListener"/&gt; &lt;/listeners&gt; &lt;/add&gt; &lt;/categorySources&gt; &lt;specialSources&gt; &lt;allEvents switchValue="All" name="All Events"/&gt; &lt;notProcessed switchValue="All" name="Unprocessed Category"/&gt; &lt;errors switchValue="All" name="Logging Errors &amp; Warnings"&gt; &lt;listeners&gt; &lt;add name="Database TraceListener"/&gt; &lt;/listeners&gt; &lt;/errors&gt; &lt;/specialSources&gt; &lt;/loggingConfiguration&gt; &lt;exceptionHandling&gt; &lt;exceptionPolicies&gt; &lt;add name="PayrollException"&gt; &lt;exceptionTypes&gt; &lt;add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" name="Exception"&gt; &lt;exceptionHandlers&gt; &lt;add exceptionMessage="Payroll Application Exception" wrapExceptionType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionHandlingException, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WrapHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="Wrap Handler"/&gt; &lt;/exceptionHandlers&gt; &lt;/add&gt; &lt;/exceptionTypes&gt; &lt;/add&gt; &lt;/exceptionPolicies&gt; &lt;/exceptionHandling&gt; &lt;connectionStrings&gt; &lt;add name="Conn" connectionString="Database=Payroll;Server=10.135.158.211;User Id=xanoneappusr;Password=vivekm123;" providerName="System.Data.SqlClient"/&gt; &lt;add name="LoggingConn" connectionString="Database=Logging;Server=10.135.158.211;User Id=xanoneappusr;Password=vivekm123;" providerName="System.Data.SqlClient"/&gt; &lt;/connectionStrings&gt; &lt;appSettings&gt; &lt;add key="PayrollApplication" value="Payroll"/&gt; &lt;/appSettings&gt; &lt;system.web&gt; &lt;compilation debug="true" batch="false"&gt; &lt;assemblies&gt; &lt;add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/&gt; &lt;add assembly="System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/&gt;&lt;/assemblies&gt;&lt;/compilation&gt; &lt;roleManager enabled="true"/&gt; &lt;authentication mode="Forms"/&gt; &lt;membership&gt; &lt;providers&gt; &lt;clear/&gt; &lt;add connectionStringName="Conn" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0" applicationName="PayrollApplication" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider"/&gt; &lt;/providers&gt; &lt;/membership&gt; &lt;/system.web&gt; &lt;/configuration&gt;#x# </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload